Where can I find a g++ 4.7 package?

Solution 1:

The Toolchain test builds PPA contains many packages including gcc-4.7.

You can add the repository using

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

Then, to install it use

sudo apt-get update
sudo apt-get install g++-4.7

To change the default compiler use update-alternatives

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
sudo update-alternatives --config gcc