当使用GCC编译时如果代码中使用了C++11的标准,如果只用gcc -o就会提示错误。
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
当使用GCC编译时,如果需要使用C++11的标准去编译。就需要在编译时指令中加入-std=c++11
g++ -std=c++11 -o main main.cpp