Installing GCC 4.7 in Ubuntu 12.04


Ubuntu 12.04 provides only GCC 4.6. To get GCC 4.7 (and its more advanced C++11 support), you need either to use Ubuntu 12.10 or you need to add a toolchain test repository. This page summarizes the latter option.

To install GCC 4.7 in Ubuntu 12.04, do the following:

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

To switch the default gcc frontend to the newer compiler, do the following (still under root)

cd /usr/bin
for f in *-4.7 ; do n="${f/-4.7}" ; if [ -L "$n" ] ; then ln -sfv "$f" "$n" ; fi ; done

Inspired from http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7.

Share

, , ,

Les commentaires sont fermés.