【发布时间】:2016-04-01 12:25:43
【问题描述】:
我只是好奇标准选择开关的位置(我的情况是-std=c++11)是否与 g++ 命令行相关。原因如下:
g++ -ftest-coverage -fprofile-arcs -std=c++11
-ansi -fpermissive -finline-functions -Wno-long-long
-fvisibility-inlines-hidden -m64 -Wall -Wextra
-g -o CMakeFiles/common.dir/cryptoclass.cpp.o
-c /home/work/common/cryptoclass.cpp
不编译,而如下:
g++ -ftest-coverage -fprofile-arcs
-ansi -fpermissive -finline-functions -Wno-long-long
-fvisibility-inlines-hidden -m64 -Wall -Wextra
-g -o CMakeFiles/common.dir/cryptoclass.cpp.o
-std=c++11 -c /home/work/common/cryptoclass.cpp
编译。唯一的变化是-std=c++11 被移到了开关的末尾。
g++ 给出以下警告:
error: #error This file requires compiler and
library support for the ISO C++ 2011 standard.
This support is currently experimental, and must
be enabled with the -std=c++11 or -std=gnu++11 compiler options.
版本:
g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
【问题讨论】:
-
我总是将
-std=...设为编译器的第一个选项并且工作正常。