51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3478|回复: 1
打印 上一主题 下一主题

[求助] C++test问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2011-6-21 17:20:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我在代码中使用了CArray
发现编译不通过?
程序:
class A
{
public:
        A(){};
        ~A(){};

        void f1(A &x){a = x.a;};
        int geta(){return a;};
private:
           int a;
};


#include "afxtempl.h"
typedef CArray< A *, A *>  CArrayA;

class C
{
public:
   CArrayA c;  

};

int test5(C &x ,int b ,int c)
{

        A * a= x.c[0];
       
        if (a->geta()>b && c>b)
        {
                return 1;
        }
        else
        {
                return 11;
        }
       
}


Error: Compile failed for: E:\testMain.cpp .

那位大侠遇到过?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2011-6-21 18:36:35 | 只看该作者
------------------------

Using test configuration: builtin://CompleteAnalysis



------------------------

Precompiling E:\LightSrc\testMain.cpp

Working directory: E:\LightSrc

"D:\\Program Files\\Microsoft Visual Studio\\VC98\\bin\\cl.exe" -GX /I . /c /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /MLd /GX /nologo -TpE:\\LightSrc\\testMain.cpp -FoE:\\project\\ssf\\Product\\testMain.cpp_0\\testMain.o -Zi -Od -w /nologo -c -FdE:\\project\\ssf\\Product\\testMain.cpp_0\\testMainMSVC++-6.0.pdb



Process exited with code 0



Precompile done.



Preparing harness for: E:\LightSrc\testMain.cpp

Working directory: E:\LightSrc

harness.exe /I . /c /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /MLd /GX /nologo --compileracronym=MSVC++-6.0 --fileName=E:\\LightSrc\\testMain.cpp --outputFileName=E:\\project\\ssf\\Product\\testMain.cpp_0\\Instr\\testMain_2000.cpp --instrumentation-mode=60 --ignore-path=+* --ignore-path=-E:\\LightSrc\\* --ignore-path=-*\\testMain.h* --ignore-path=-E:\\LightSrc\\testMain.cpp --pre-include-header=cpptest_defs.h --pre-include-header=_mt_harness_config.h --symbols-files-list=E:\\project\\ssf\\Product\\testMain.cpp_0\\Instr\\harness.out --instr-unit-id=2 "--preprocessorExecutable=D:\\Program Files\\Microsoft Visual Studio\\VC98\\bin\\cl.exe"



Process exited with code 0



Preparing harness done.



Reading symbols for E:\LightSrc\testMain.cpp

Reading symbols done.



Loading symbols data for E:\LightSrc\testMain.cpp

Loading symbols data done.



Collecting library information for E:\LightSrc\testMain.cpp

Working directory: E:\LightSrc

libdetector.exe "--ldvLinkerExecutable=D:\\Program Files\\Microsoft Visual Studio\\VC98\\bin\\link.exe" --compiler-acronym=MSVC++-6.0 --store-libraries=E:\\project\\ssf\\Product\\testMain.cpp_0\\ext_libs.cts E:\\project\\ssf\\Product\\testMain.cpp_0\\testMain.o advapi32.lib kernel32.lib odbccp32.lib comdlg32.lib odbc32.lib ole32.lib gdi32.lib winspool.lib user32.lib uuid.lib /machine:I386 shell32.lib /nologo oleaut32.lib /pdbtype:sept /debug /DEBUG /PDB:E:\\project\\ssf\\Product\\testMain.cpp_0\\testMainTest.pdb /OUT:E:\\project\\ssf\\Product\\testMain.cpp_0\\testMainTest.exe /nologo "D:\\Program Files\\Parasoft\\C++Test\\lib\\mtapp.lib"



Process exited with code 0



Collecting library information done.



Collecting symbol definitions information for E:\LightSrc\testMain.cpp

Working directory: E:\LightSrc

lsc.exe --read-library-list=E:\\project\\ssf\\Product\\testMain.cpp_0\\ext_libs.cts --store-symbols=E:\\project\\ssf\\Product\\testMain.cpp_0\\symbols_from_ext_libs.cts



Process exited with code 0



Collecting symbol definitions information done.



Matching symbol definitions information for E:\LightSrc\testMain.cpp

Working directory: E:\LightSrc

symmatcher.exe --compiler-acronym=MSVC++-6.0 --read-symbols=E:\\project\\ssf\\Product\\testMain.cpp_0\\symbols_from_ext_libs.cts --store-config=E:\\project\\ssf\\Product\\testMain.cpp_0\\lib_defined_symbols.cts --read-inames=E:\\project\\ssf\\Product\\testMain.cpp_0\\inames.cts



Process exited with code 0



Matching symbol definitions information done.



Applying stubs configuration for E:\LightSrc\testMain.cpp

Applying stubs configuration done.



------------------------

Preparing symbol definitions configuration for E:\LightSrc\testMain.cpp

Working directory: E:\LightSrc

defsgen.exe --read-config=E:\\project\\ssf\\Product\\testMain.cpp_0\\src_defined_symbols.cts --read-config=E:\\project\\ssf\\Product\\testMain.cpp_0\\lib_defined_symbols.cts --read-config=E:\\project\\ssf\\Product\\testMain.cpp_0\\tbl_defined_symbols.cts --read-config=E:\\project\\ssf\\Product\\testMain.cpp_0\\usr_defined_symbols.cts --read-harness-elements=E:\\project\\ssf\\Product\\testMain.cpp_0\\harness_elements.cts --generate-header=E:\\project\\ssf\\Product\\testMain.cpp_0\\Instr\\include\\cpptest_defs.h



Process exited with code 0



Preparing symbol definitions configuration done.



Compiling E:\project\ssf\Product\testMain.cpp_0\Instr\testMain_2000.cpp

Working directory: E:\LightSrc

"D:\\Program Files\\Microsoft Visual Studio\\VC98\\bin\\cl.exe" -GX -IE:\\project\\ssf\\Product\\testMain.cpp_0\\Instr\\include "-ID:\\Program Files\\Parasoft\\C++Test\\etc\\include" -IE:\\project\\ssf\\Product -IE:\\project\\ssf\\Product\\testMain.cpp_0 /I . /c /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /MLd /GX /nologo -TpE:\\project\\ssf\\Product\\testMain.cpp_0\\Instr\\testMain_2000.cpp -FoE:\\project\\ssf\\Product\\testMain.cpp_0\\ctbin\\testMain.obj -Zi -Od -w /nologo -c -FdE:\\project\\ssf\\Product\\testMain.cpp_0\\ctbin\\testMainMSVC++-6.0.pdb



Process exited with code 0



Linking harness for E:\LightSrc\testMain.cpp

Working directory: E:\LightSrc

"D:\\Program Files\\Microsoft Visual Studio\\VC98\\bin\\link.exe" E:\\project\\ssf\\Product\\testMain.cpp_0\\ctbin\\testMain.obj advapi32.lib kernel32.lib odbccp32.lib comdlg32.lib odbc32.lib ole32.lib gdi32.lib winspool.lib user32.lib uuid.lib /machine:I386 shell32.lib /nologo oleaut32.lib /pdbtype:sept /debug /DEBUG /PDB:E:\\project\\ssf\\Product\\testMain.cpp_0\\ctbin\\testMainTest.pdb /OUT:E:\\project\\ssf\\Product\\testMain.cpp_0\\ctbin\\testMainTest.exe /nologo "D:\\Program Files\\Parasoft\\C++Test\\lib\\mtapp.lib"



Process exited with code 1120



Error: Linking harness failed for:
E:\LightSrc\testMain.cpp .



Coding Standards results for E:\LightSrc\testMain.cpp



FILE: E:\LightSrc\testMain.cpp



------------------------

Starting Coding Standards checking for E:\LightSrc\testMain.cpp...



E:\LightSrc\testMain.cpp(7):

    All member variables should be initialized in constructor.

    Severe Violation: (init-06, MemberNotInitializedInConstructor.rule)

    Constructors do not initialize all member variables: a

E:\LightSrc\testMain.cpp(48):

    All member variables should be initialized in constructor.

    Severe Violation: (init-06, MemberNotInitializedInConstructor.rule)

    Constructors do not initialize all member variables: b

E:\LightSrc\testMain.cpp(51):

    Public member functions shall always return const handles to member data

    Severe Violation: (pbugs-26, PublicReturnConst.rule)

    Public member function getx shall return const handles to member data: b

Coding Standards checking done



------------------------

Starting Unit Testing for E:\LightSrc\testMain.cpp...



Error: Cannot start test executable:
  E:\project\ssf\Product\testMain.cpp_0\ctbin\testMainTest.exe.



------------------------

Summary of the analysis.



Test configuration: builtin://CompleteAnalysis

Elapsed time: 00:00:15

------------------------

Coding Standards

Tested: 1 file

Skipped: 0 files

Number of detected violations: 3

Number of violated rules: 2

Number of active rules: 27

------------------------

Unit Testing (Native)

Tested: 0 files

Skipped: 0 files

Number of generated test cases: 0

Number of executed test cases: 0 (OK=0 FLD=0 ERR=0)

Coverage: LC=0%[0/0] BBC=0%[0/0] PC=0%[0/0] DC=0%[0/0] MCDC=0%[0/0] CC=0%[0/0]

------------------------

------------------------

The following problem(s) occured during testing:



Error: Linking harness failed for:
E:\LightSrc\testMain.cpp .



Error: Cannot start test executable:
  E:\project\ssf\Product\testMain.cpp_0\ctbin\testMainTest.exe.



------------------------

Set Output Verbosity Level to High (or use -Zvm2 option in command-line mode) to see details.
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-25 22:19 , Processed in 0.086088 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表