samedi 26 novembre 2016

C++11 on Netbeans 8.1 doesn't compile properly

I have a simple hello world code running on NetBeans as follows:

#include <cstdlib>
#include <iostream>

int main(int argc, char** argv) {

    cout << "Hello World!" << endl;
    return 0;
}

When compiling with the default options everything works fine but adding -std=c++11 to the g++ command gives me:

g++    -c -g -std=c++11 -MMD -MP -MF "build/Debug/MinGW-Windows/main.o.d" -o build/Debug/MinGW-Windows/main.o main.cpp
In file included from c:\mingw\include\wchar.h:208:0,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar:44,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
                 from main.cpp:15:
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 a bunch of other similar errors with iostream files. I've properly set the option on Project Properties and set the environment variables. What could it be?

Aucun commentaire:

Enregistrer un commentaire