There’re multiple gcc versions available in Ubuntu 12.04′s repository and default is 4.6.3. If you want to use some c++11 features, you need gcc-4.7 that by default excluded in Ubuntu 12.04′s repository. If you’d not like compiling gcc from source, use PPA way installing in this guide.

Launch a terminal window from the Dash or by Ctrl+Alt+T key. Add this ppa:

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

Update the source:

sudo apt-get update

Then install gcc-4.7 and g++-4.7:

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