MinGW / CxxTest奇怪的错误 [英] MinGW / CxxTest bizarre errors

查看:150
本文介绍了MinGW / CxxTest奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望你能帮助我。我在我的主要开发机上写了一个使用CxxTest的小项目。一切工作伟大的这台机器,没有问题。然而,我试图在我的全新的笔记本电脑上设置这个项目,只是不能得到它的工作!我怀疑有些东西弄乱了我的MinGW安装而不是CxxTest,但它真的很难知道 - 错误来自CxxTest文件。这是项目的文件夹结构:

I hope you can help me. I have written a small project using CxxTest on my main dev machine. Everything works great on this machine, no problems. However, I tried setting up this project on my brand new laptop and just can't get it to work! I suspect something is messed up with my MinGW installation rather than CxxTest, but it's really hard to know - and the errors originate from CxxTest files. This is the folder structure of the project:

lib/
    cxxtest-4.3/
src/
    TestUtils.h
    test.cpp
test/
    MyTestSuite.h
    libstdc++-6.dll

在命令行中,我运行:

cd test
..\lib\cxxtest-4.3\bin\cxxtestgen --error-printer -o runner.cpp MyTestSuite.h

这会生成runner.cpp。现在我运行:

This generates runner.cpp. Now I run:

g++ -o runner.exe runner.cpp -I "../lib/cxxtest-4.3" -std=c++11

这通常工作正常,输出runner.exe并运行我的单元测试。在我的笔记本电脑上我只得到成千上万的错误。下面是前几个例子:

This usually works fine, outputting runner.exe and running my unit tests. On my laptop I just get thousands of errors. Here's a look at just the first few:

In file included from c:\mingw\include\wchar.h:208:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\istream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\sstream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\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:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_mode_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_off_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_ino_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_mode_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: '_off_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type
 struct stat __struct_stat_defined( _off_t, time_t );
             ^
c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '_ino_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '_mode_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: '__off64_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type
 struct _stati64 __struct_stat_defined( __off64_t, time_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_dev_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_ino_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_mode_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '_dev_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__off64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );
                 ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type
 struct __stat64 __struct_stat_defined( __off64_t, __time64_t );

当我在简单的hello world文件上运行g ++时,它工作正常。有人知道发生了什么吗?

When I run g++ on a simple hello world file, it works fine. Does anyone know what's going on?

推荐答案

我最近更新了MinGW,遇到了非常相似的问题。经过一番研究,我发现这个问题, / a>并尝试使用 -std = gnu ++ 11 替换 -std = c ++ 11 。这解决了我的问题。希望有所帮助!

I also recently updated MinGW and ran into very very similar problems. After some research I found this question on SO and tried replacing -std=c++11 with -std=gnu++11. This resolved the issue for me. Hope that helps!

这篇关于MinGW / CxxTest奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆