user123
user123

Reputation: 5407

Switch between G++ version to support C++11

I have installed 4.7 version of c++ which does not support c++11. So I followed This and installed new version which also 4.7. Now I am confused how I switch newely installed g++.

When I enter ls -lh /usr/bin/g++* I get this:

lrwxrwxrwx 1 root root   21 Aug 23 08:54 /usr/bin/g++ -> /etc/alternatives/g++
-rwxr-xr-x 1 root root 516K Apr 15 17:42 /usr/bin/g++-4.7

Both are same but How can I switch to newer?

Upvotes: 0

Views: 395

Answers (2)

remram
remram

Reputation: 5203

There is no way your package installer would have let you have two separate installations of g++ 4.7. The page you linked states that you'd end up with both 4.6 and 4.7, not two versions 4.7.

If you had different g++ version, you could select which one gets used by the g++ command using update-alternatives --config g++, however running g++-4.7 will always get you the 4.7 version.

Also note that 4.7 does support some C++11 features (use -std=c++11), but not all of them. This page lists the status of the implementation.

Upvotes: 1

C. K. Young
C. K. Young

Reputation: 223023

gcc 4.7 does support C++11, if you run it with the -std=c++11 option. Have you tried that?

Upvotes: 2

Related Questions