How to install g++ in Ubuntu 14.04? [duplicate]
I have recently installed ubuntu 14.04 in virtual box. Now I want to install g++ 4.7 in it. I am trying this command in terminal but its not working.
sudo apt-get install g++-4.7
Reading package list... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package g++-4.7
E: Couldn't find any package by regex 'g++-4.7'
But I find gcc was there with Ubuntu 14.04 installation itself.
How could I install g++ in ubuntu 14.04 and any version of g++ abouve 4.7.2 is fine with me.
You don't need to specify the version when you install if you want the most updated package.
Command-line method
-
Do the following on a terminal:
sudo apt-get update
to update your package list with the most recent version of g++ enter you password and press Return and then,
-
Do:
sudo apt-get install g++
to install
g++
.
GUI method
You could also install it from the Software Center. Type "Software Center" on the dash and then type g++
in the search bar after software center opens up and then click on install and enter your password.
I think that g++ is installed by default when you install gcc. Try to type in g++ in the terminal and see what happens. If you can't find it with what the previous person said, best chance of getting it is going to the GCC website and download the source and compile.