I can't add comments in Ask Ubuntu yet, but I wanted to make a note to these answers in-case others trying to install GCC 4.8 run into the same issues as I did. When I got to the commends: sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++ I got the responses: update-alternatives: error: no alternatives for gcc update-alternatives: error: no alternatives for g++ On top of that, after running through the rest of the steps, running gcc --version still says its version 4.7, though 4.8 is installed. running ls -l /usr/bin/gcc* and ls -l /usr/bin/g++* shows th
–
Ten_Ten_SteveJul 14 '13 at 16:20

3 Answers
3

Use the mirrors listed Here and download the 4.8.1. The process is pretty straightforward. I would recommend to use this Procedure to complete your installation.

As you may know GCC doesn't support "make uninstall" and it has been suggested that you install GCC into a directory of its own and simply remove that directory when you do not need that specific version of GCC any longer. Hope this helped. Cheers

Edited: The Option 2:

I assume that you already have a former version of gcc, the easiest way could be adding PPA to your repositories and Update and upgrade you can have the latest version with no worries:

Thanks for the reply Amir. But I already Googled that page & understood nothing .. I don't know which files should I download... Also the fact that you said to install gcc in a folder goes over my head as I don't know how to do that :( Can you please tell me step by step
–
sud_the_devilJun 25 '13 at 17:54

@sud_the_devil, did you be able to fix the issue using the edited version of my answer? If so, please "Accept" the answer so that the others could benefit in the future as well ;)
–
AmirAug 4 '13 at 22:48

Do you know of a PPA for Quantal/12.10? The packages in that PPA are currently broken.
–
detlyOct 27 '13 at 22:49

You might find typing the extra -4.8 annoying, in which case follow the other answers given by raven and Amir. I quite like this method, as it gives me the choice to use a fall-back version (4.7) if I encounter a bug!

Thanks for this concise option. I want to point out that the apt-get install line should read: sudo apt-get install gcc-4.8 g++-4.8 The dash is needed there, and its absense might confuse a newbie.
–
Justin WNov 19 '13 at 22:05

I did that exactly (copy and paste), but remove steps returned error: no alternatives for gcc and at the end the default is still the old g++ 4.7.3. New version is available with g++-4.8.
–
Paul JurczakAug 21 '13 at 2:13