使用std c ++ 11编译MinGW g ++

时间:2016-08-14 09:46:01

标签: c++ c++11 mingw

所以我想用MinGW编译我的简单程序。我总是倾向于添加-std=c++11参数,但现在(我已经格式化了我的笔记本电脑)它不起作用。对我来说唯一的变化(我认为)是安装Cygwin。现在,当我使用这个程序:g++ main.cpp -std=c++11时:

#include <iostream>

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

它给我这样的东西:

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 );

还有很多很多行。实际上它确实与-std=gnu++11一起使用,但为什么不与c++11一起使用?我在Windows上工作

0 个答案:

没有答案