我正在尝试用 cppunit 测试我的 qt 项目。测试项目使用 MFC。我正在使用 Visual Studio 2010。
我已经包含了 qt 库、dll 并在项目设置中进行了其他更改,例如添加预处理器定义来编译我想要测试的 cpp 文件。但是当我编译这个cpp文件时,我得到了很多语法错误,位于qt头文件中。编译输出如下:
1>------ Build started: Project: my_tests, Configuration: Debug Win32 ------
1>cl : Command line warning D9025: overriding '/ZI' with '/Zi'
1>cl : Command line warning D9025: overriding '/GS' with '/GS-'
1>cl : Command line warning D9025: overriding '/Zc:wchar_t' with '/Zc:wchar_t-'
1> CSetting.cpp
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2143: syntax error : missing ')' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2143: syntax error : missing ';' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2805: binary 'operator <<' has too few parameters
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2059: syntax error : ')'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2143: syntax error : missing ')' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2143: syntax error : missing ';' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2805: binary 'operator <<' has too few parameters
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2988: unrecognizable template declaration/definition
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2059: syntax error : 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2065: 'T' : undeclared identifier
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2059: syntax error : ')'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(178): error C2065: 'T' : undeclared identifier
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(180): error C2143: syntax error : missing ';' before '{'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(180): error C2447: '{' : missing function header (old-style formal list?)
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(190): error C2143: syntax error : missing ')' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(190): error C2143: syntax error : missing ';' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(190): fatal error C1903: unable to recover from previous error(s); stopping compilation
请帮我解决这些错误..