Vector
Vector

Reputation: 11703

Is the GNU compiler that comes with Ubuntu 12.04 not compliant with C++ 11?

Been having some problems with the Ubuntu 13.04 updates so I took down my Ubuntu 13.04 system and installed 12.04 LTS and the gnome shell, which is the look and feel I prefer.

I use Ubuntu mostly for C++ development and use C++ 11. My preferred IDE is CodeLite http://www.codelite.org/.

I installed CodeLite and added the C++ 11 compiler switches for the GNU g++ C++ compiler: -std=c++11, as I did previously. (I have many projects that use C++ 11 and I can compile and build them fine on 13.04.)

But I can't compile a project using the compiler switch on 12.04. I get a an error message:

cc1plus: error: unrecognized command line option ‘-std=c++11’.

Without the C++ 11, I can build and run a C++ project without problems.

Is the GNU compiler that comes with Ubuntu 12.04 not compliant with C++ 11? How do I fix this? I looked in Synaptic and didn't find any upgrades available. I have never tried it before on 12.04, but C++ 11 switch was working fine on 12.10.

Am I stuck? How can I fix this so I can stay on 12.04 and use C++ 11?

Upvotes: 2

Views: 6749

Answers (1)

Casey
Casey

Reputation: 42554

GCC versions prior to 4.7 use "-std=c++0x" instead of "-std=c++11" since the standard wasn't definitely C++11 at the time those versions were released. There are C++11 features present in later GCC versions that will not be implemented on older versions. GCC 4.8.1 is the first release that is truly C++11 feature-complete.

I imagine you can update the compiler packages to something recent while keeping the majority of your Ubuntu install at 12.04.

Upvotes: 6

Related Questions