cc1plus: error: unrecognized command line option “-std=c++11” with g++

后端 未结 4 1998
后悔当初
后悔当初 2020-12-01 02:31

I\'m trying to compile using g++ and either the -std=c++11 or c++0x flags.

However, I get this error

cc1plus:         


        
4条回答
  •  攒了一身酷
    2020-12-01 03:16

    Quoting from the gcc website:

    C++11 features are available as part of the "mainline" GCC compiler in the trunk of GCC's Subversion repository and in GCC 4.3 and later. To enable C++0x support, add the command-line parameter -std=c++0x to your g++ command line. Or, to enable GNU extensions in addition to C++0x extensions, add -std=gnu++0x to your g++ command line. GCC 4.7 and later support -std=c++11 and -std=gnu++11 as well.

    So probably you use a version of g++ which doesn't support -std=c++11. Try -std=c++0x instead.

    Availability of C++11 features is for versions >= 4.3 only.

提交回复
热议问题