0

I have g++ 4.6, 4.7 and 4.8 installed, but not g++ itself. I am using Ubuntu 12.04. If I do:

g++ --version

it says:

The program 'g++' can be found in the following packages:
 * g++
 * pentium-builder

I have tried the following:

sudo apt-get update

then

sudo apt-get -f install

then

sudo apt-get install g++

but still I get the same when checking g++ version. Please help?

Doing apt-cache policy g++ yields:

g++:
  Installed: 4:4.6.3-1ubuntu5
  Candidate: 4:4.6.3-1ubuntu5
  Version table:
 *** 4:4.6.3-1ubuntu5 0
        500 http://gb.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status
Braiam
  • 69,112

1 Answers1

2

The package g++ is a metapackage that depends on the last version of g++. In raring it depends on g++-4.7:

apt-cache depends g++
g++
  Depends: cpp
  Depends: gcc
  Depends: g++-4.7
  Depends: gcc-4.7
  Suggests: g++-multilib
  Conflicts: g++:i386

The packages/binaries you are looking for is g++-4.8 and g++-4.7:

apt-cache policy g++-4.7
g++-4.7:
  Installed: 4.7.3-1ubuntu1
  Candidate: 4.7.3-1ubuntu1
  Version table:
 *** 4.7.3-1ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ raring/main amd64 Packages
        100 /var/lib/dpkg/status

g++-4.8 isn't available in raring. To use any of them you have to imply them:

$ type g++
g++ is /usr/bin/g++
$ ls -l /usr/bin/g++
lrwxrwxrwx 1 root root 7 abr 22  2013 /usr/bin/g++ -> g++-4.7
$ type g++-4.7
g++-4.7 is /usr/bin/g++-4.7

If you have installed g++-4.7 you need to declare that you want to use g++-4.7.

Braiam
  • 69,112