The above solution using -std=c++11 does not work for me.
This is information about the purpose and version of my compiler.
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) Target: x86_64-linux-gnu
When I tried, this is what happened.
$ g++ -std=c++11 program.cpp cc1plus: error: unrecognized command line option '-std=c++11'
This solved the problem for me.
$ g++ -std=c++0x program.cpp
source share