Error: unrecognized command line option “-std=c++11”, to solve the problem that ubuntu does not support c++11

The cause of this compilation error is not high enough in the g++ GCC version.
Add the source

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

$ sudo apt-get update

Install version 4.8

$ sudo apt-get install gcc-4.8 g++-4.8

View the local installation version

$ ls -lh /usr/bin/g++*

You should see that 4.6 and 4.8 are shipped.
Switch version

$ 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.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8

$ sudo update-alternatives --config gcc

here select version 4.8 serial number
Check the g++ version again

$ g++ --version

Confirm that the current version is 4.8, the problem has been solved!
From: http://my.oschina.net/chenyoca/blog/226455

Read More: