Ubuntu 编译出现 ISO C++ 2011 不支持的解决办法

问题

在编译时出现如下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.

原因

编译的时候未开启 ISO C++ 2011 的支持选项,无法支持 ISO C++ 11 的有关语法

解决办法

修改MakeFile,在其中的

g++ -o test test.cpp

加上一行 -std=c++11,变成

g++ -std=c++11 -o test test.cpp

即可编译成功

猜你喜欢

转载自www.cnblogs.com/vancasola/p/9849024.html