Search code examples
c++gccc++11g++cygwin

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?


Solution

  • 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.