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
On the command line I run:
cd test
..\lib\cxxtest-4.3\bin\cxxtestgen --error-printer -o runner.cpp MyTestSuite.h
This generates runner.cpp. Now I run:
g++ -o runner.exe runner.cpp -I "../lib/cxxtest-4.3" -std=c++11
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 );
When I run g++ on a simple hello world file, it works fine. Does anyone know what's going on?
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!
来源:https://stackoverflow.com/questions/38436542/mingw-cxxtest-bizarre-errors