3
gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04) 

I have a problem with g++

When I search for g++ I find nothing!

So I tried to install it; it seems like g++ is already installed and it's the newest one!

arubu@CQ56-LinuxMachine:~$ which g++
arubu@CQ56-LinuxMachine:~$ sudo apt-get install g++
[sudo] password for arubu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++ is already the newest version.
g++ set to manually installed.
The following packages were automatically installed and are no longer required:
  libgranite-common libgranite1 libkeybinder-3.0-0
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
arubu@CQ56-LinuxMachine:~$ g++ -v
The program 'g++' is currently not installed. You can install it by typing:
sudo apt-get install g++
1
  • Also check dpkg -l g++. Commented Apr 21, 2016 at 21:47

2 Answers 2

4

You should force the re-installation of the g++ package; this will restore the appropriate symbolic links:

sudo apt-get --reinstall install g++

Once this is done you should find that /usr/bin/g++ exists once again and is a symbolic link to g++-5.

4

The /usr/bin/g++ is a symbolic link to the real executable which is /usr/bin/x86_64-linux-gnu-g++. I guess your symbolic link is missing. Try and see if the latter file exists but the former does not. Then you can fix it manually by issuing sudo ln -sv /usr/bin/X86_64-linux-gnu-g++ /usr/bin/g++.

This answer is taken from here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .