简体   繁体   中英

Cannot compile using -std flag with g++

I'm running Windows 7 with cygwin installed and trying to have a play around with some of the newer C++ features. I'm aware that in order to enable these features I have to pass g++ the -std=c++0x flag, however that gives me the following error:

cc1plus: error: unrecognized command line option "-std=c++0x"

The command line I'm issueing that gives rise to that error is:

g++-3 hello.cpp -std=c++0x -o hello

The reason for the g++-3 is because windows has trouble with the symbolic link. I've used g++ in the cygwin terminal and the result is the same anyway.

Any ideas?

You need to be using a version of GCC which supports C++ 2011 features.

This page has a list of compilers and which features each one supports . If I were you, I'd try to use GCC 4.7 if at all possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM