Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Ubuntu 10.04 32-bit with gcc 4.4.3 currently installed on it. I want to upgrade it to gcc/g++ 4.7 (I am looking for C++ 0x support)

How to update using Ubuntu Package Manager:

apt-get upgrade/install ??

As a second option I downloaded the latest gcc snapshot file from:

Would doing

make install 

on this package build and install it from source?

share|improve this question
Same question asked by you… – krupal6022 Jul 6 '13 at 14:50
switch to root user : sudo su - goto /usr/bin then run ls -l gcc* and post your output. then I'll post your answer. – Afshin Hamedi Aug 14 '14 at 9:51


Add the toolchain ppa test repository, then do apt-get update, and apt-get dist-upgrade

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.7 c++-4.7

This is only available in 12.04 - older ubuntu versions cannot be updated to this same version using this method.

See here for further information about PPAs

share|improve this answer
you mean sudo apt-get install gcc-4.7 c++-4.7? There must be something wrong because typing "gcc --version" after doing that still returns 4.6.3 – user2413 Jul 5 '12 at 11:15
@user2413 this installs g++4.7 as a separate program and you could use g++-4.7 *.cpp; what you may want is sudo apt-get upgrade – manuzhang Feb 12 '13 at 12:01
Worked for me on 10.04, without the c++-4.7 part. – Ajith Apr 8 '13 at 9:42
WARNING: It work for me on quantal (12.10), but it removed acroread, valgrind no longer works and I couldn't attach gdb to a running process. – sehe Sep 7 '13 at 14:49
Watch out, check the section The following packages will be REMOVED. On Ubuntu 10.04 the install g++4.7 command above wanted to remove 100s of packages including my xserver, gnome desktop, eclipse, chrome, xulrunner, etc... – jcalfee314 Feb 10 '14 at 0:56
sudo apt-get install gcc-snapshot

Then, invoke it with:


For the second part of the question, the answer is "yes, sort of". If you really want to do that (i.e. installing the gcc-snapshot package isn't enough) then you'll need to install the dependencies:

sudo apt-get build-dep gcc-snapshot

Then, find the correct configure options:

gcc -v

(and modify the install path etc.)

Then, build like this:

mkdir objdir
cd objdir
make install
share|improve this answer
BTW, if you do build from source, expect problems linking crti.o. Search other questions here for solutions how to fix that. – ams Nov 15 '11 at 15:16
In 10.04 this instructions bring gcc-4.5 (not 4.6 or 4.7), as reported by /usr/lib/gcc-snapshot/bin/gcc -v – alfC Dec 14 '11 at 7:48

10.04 LTS

Use the following command to install add-apt-repository:

apt-get install python-software-properties

Then add the tooclain ppa test repo as described for 12.04 LTS.

share|improve this answer
This seems to be saying to install the package that provides the Software Sources window, then once you have that, you can go ahead and use the Software Sources window to add the PPA. But the Software Sources window certainly does exist in 10.04; you don't have to install anything to get it! Also, the method this refers to for adding the PPA doesn't require opening the Software Sources window or using the GUI at all. @Plexo, can you explain further or expand on this? – Eliah Kagan Jun 17 '12 at 9:15

How to install gcc 4.8 on Ubuntu 10.04:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8

sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

Verify gcc version with:

g++ --version

It worked on my machine. Source:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.