I’m trying to compile using
g++ and either the
However, I get this error
cc1plus: error: unrecognized command line option "-std=c++11"
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Seeing from your G++ version, you need to update it badly. C++11 has only been available since G++ 4.3. The most recent version is 4.7.
In versions pre-G++ 4.7, you’ll have to use
-std=c++0x, for more recent versions you can use
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
Availability of C++11 features is for versions >= 4.3 only.
you should try this
g++-4.4 -std=c++0x or g++-4.7 -std=c++0x
I also got same error, compiling with -D flag fixed it, Try this: