MinGW/Cxx测试奇怪的错误
MinGW / CxxTest bizarre errors
我希望你能帮助我。我在我的主开发机器上用CxxTest写了一个小项目。这台机器上一切都很好,没有问题。然而,我试着在我的全新笔记本电脑上设置这个项目,但就是无法实现!我怀疑我的MinGW安装而不是CxxTest出了问题,但这真的很难知道——错误源于CxxTest文件。这是项目的文件夹结构:
lib/
cxxtest-4.3/
src/
TestUtils.h
test.cpp
test/
MyTestSuite.h
libstdc++-6.dll
在命令行上我运行:
cd test
..libcxxtest-4.3bincxxtestgen --error-printer -o runner.cpp MyTestSuite.h
这会生成runner.cpp。现在我运行:
g++ -o runner.exe runner.cpp -I "../lib/cxxtest-4.3" -std=c++11
这通常运行良好,输出runner.exe并运行我的单元测试。在我的笔记本电脑上,我只收到成千上万的错误。以下是前几个:
In file included from c:mingwincludewchar.h:208:0,
from c:mingwlibgccmingw324.9.3includec++cwchar:44,
from c:mingwlibgccmingw324.9.3includec++bitspostypes.h:40,
from c:mingwlibgccmingw324.9.3includec++iosfwd:40,
from c:mingwlibgccmingw324.9.3includec++ios:38,
from c:mingwlibgccmingw324.9.3includec++istream:38,
from c:mingwlibgccmingw324.9.3includec++sstream:38,
from c:mingwlibgccmingw324.9.3includec++complex:45,
from ../lib/cxxtest-4.3/cxxtest/StdHeaders.h:24,
from ../lib/cxxtest-4.3/cxxtest/StdValueTraits.h:22,
from ../lib/cxxtest-4.3/cxxtest/ValueTraits.h:400,
from ../lib/cxxtest-4.3/cxxtest/TestSuite.h:24,
from ../lib/cxxtest-4.3/cxxtest/RealDescriptions.h:20,
from ../lib/cxxtest-4.3/cxxtest/TestRunner.h:22,
from runner.cpp:11:
c:mingwincludesys/stat.h:173:14: error: '_dev_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:173:14: error: '_ino_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:173:14: error: '_mode_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:173:14: error: '_dev_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:173:14: error: '_off_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:173:14: error: 'time_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:173:14: error: 'time_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:173:14: error: 'time_t' does not name a type
struct _stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: '_dev_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: '_ino_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: '_mode_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: '_dev_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: '_off_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: 'time_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: 'time_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:180:13: error: 'time_t' does not name a type
struct stat __struct_stat_defined( _off_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: '_dev_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: '_ino_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: '_mode_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: '_dev_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: '__off64_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: 'time_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: 'time_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:188:17: error: 'time_t' does not name a type
struct _stati64 __struct_stat_defined( __off64_t, time_t );
^
c:mingwincludesys/stat.h:195:17: error: '_dev_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
^
c:mingwincludesys/stat.h:195:17: error: '_ino_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
^
c:mingwincludesys/stat.h:195:17: error: '_mode_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
^
c:mingwincludesys/stat.h:195:17: error: '_dev_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
^
c:mingwincludesys/stat.h:195:17: error: '__off64_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
^
c:mingwincludesys/stat.h:195:17: error: '__time64_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
^
c:mingwincludesys/stat.h:195:17: error: '__time64_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
^
c:mingwincludesys/stat.h:195:17: error: '__time64_t' does not name a type
struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
当我在一个简单的helloworld文件上运行g++时,它运行得很好。有人知道发生了什么事吗?
我最近也更新了MinGW,遇到了非常相似的问题。经过研究,我在SO上发现了这个问题,并尝试用-std=gnu++11
代替-std=c++11
。这为我解决了问题。希望能有所帮助!
如果您正在使用CMake,请确保您有
set( CMAKE_CXX_EXTENSIONS ON )
在您的CMakeLists.txt文件
相关文章:
- 在cygwin中测试新的boost安装时出现cpp错误
- 在C++中使用 Catch 测试框架编译错误"error: expected ';' at end of declaration list"
- 运行 C++ 单元测试时LNK2005链接错误
- 这个失败的测试是将零添加到空指针未定义的行为、编译器错误还是其他什么?
- 在Raspbian上编译pybind11测试用例时出现致命错误
- 我遇到了黑客排名中的问题"TWO STRINGS"的三个测试用例的分段错误。原因是什么?
- _mm256_load_ps调试模式下导致谷歌/基准测试的分段错误
- 使用谷歌测试进行测试时出现分段错误
- 谷歌测试编译错误 Os X:函数式转换从"int"到"internal::FloatingEq2Matcher"的模糊转换<float>
- 链接CPP文件进行测试时发生LNK2019错误
- 使用cmake构建google测试单元测试时出现链接器错误
- Cmake无法在qt-creater/collect2上编译简单的测试程序:错误:ld
- 谷歌启动2018,测试用例中的整数错误
- 错误 在测试.exe 0x76C9FD62时出现未经处理的异常:Microsoft C++异常:内存位置0x006FF8
- 外部 "C" Visual Studio 2015 中的显式类型错误,DLL 测试代码
- 为什么谷歌测试/模拟显示 std::unique_ptr 泄露的模拟对象错误?
- 有没有办法使用 Clang 减小编译器错误测试用例的预处理源代码的大小
- Qt 5构建错误:测试表达式后的额外字符
- C++ 昨天分段错误测试的代码工作完美,现在它出错了
- 测试设置错误:测试树为空