Friday, January 4, 2013

Install GCC 4.7.2 on Ubuntu Linux

To try the new of C++11 on Ubuntu, we can install GCC 4.7 or later. GCC 4.7.2 have been release.

To install GCC 4.7 on Ubuntu, open a Terminal and type the command:

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

To made the g++4.7 as default, type the command:

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