0

So I want to compile my simple program with MinGW. I always tended to add the -std=c++11 argument, but now (I've formatted my laptop) it does not work. The only change for me (as I think) was installing Cygwin. Now when I go for: g++ main.cpp -std=c++11 with this program:

#include <iostream>

int main(int argc, char** argv)
{
    std::cout<<"Stupid MingGW"<<std::endl;
}

It gives me something like this:

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++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from main.cpp:1:
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 );

And many, many lines more. Actually it does work with -std=gnu++11, but why not with c++11?. Im working on Windows

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
minecraftplayer1234
  • 2,127
  • 4
  • 27
  • 57
  • Not sure if it works, but see this: [MinGW / CxxTest bizarre errors](http://stackoverflow.com/questions/38436542/mingw-cxxtest-bizarre-errors) which redirect to another post. – YiFei Aug 14 '16 at 10:27
  • 1
    Maybe try mingw-w64? I always had good results for that using `c++11`, barring some issues with `std::thread` (which can be solved) – Chris Beck Aug 14 '16 at 22:52
  • This did the job for me (even `-std=c++14` works): https://nuwen.net/mingw.html – minecraftplayer1234 Aug 15 '16 at 14:58

0 Answers0