. Advertisement .
..3..
. Advertisement .
..4..
I’m trying to run a new project. I do a couple of things like this:
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.
But in my program, I am getting the warning:
cc1plus: error: unrecognized command line option "-std=c++11"
Can someone explain why the “ cc1plus: error: unrecognized command line option “-std=c++11″” issue happened? Where have I gone wrong? Thank you!
The cause: This error happens because you didn’t update your G++ version. C++11 has only been available since G++ 4.3.
Solution: You need to update it to 4.7 – which is the most recent version. You’ll have to use
-std=c++0x
in versions pre-G++ 4.7 and for more recent versions you can use-std=c++11
.Quoting from gcc webpage
You probably use a version g++ that doesn’t support
-std=c++11
.-std=c++0x
is a better alternative.Only versions greater than 4.3 are eligible for C++11 features.