Why can't I install g++?
Solution 1:
Run:
sudo apt-get update
You should always run that before installing or upgrading packages on the command-line (unless you've run it very recently). It fetches information about what packages are available in what versions from where.
You may simply be able to install g++
now, but go ahead and do as Web-E says (after running the above command), to fix any currently broken dependencies:
sudo apt-get -f install
(The -f
can actually go before or after the install
; the effect is the same.)
Then try installing g++
again:
sudo apt-get install g++
If that still fails, please edit your question to show any error messages (and also the output of the above two commands when you ran them). But it should succeed.