gcc要求使用-std = c ++ 11即使我已经在使用它了

dad*_*ada 0 c++ gcc compiler-errors compilation c++11

我正在尝试编译页面中提供的代码.这是我正在使用的gcc命令:

$HOME/gcc-6.3.0/bin/g++ -std=c++11 -Wall -ansi -g -Wno-deprecated -I./util -finline-limit=100000 -c -o type.o type.cpp
Run Code Online (Sandbox Code Playgroud)

我收到以下错误和警告:

In file included from ~/gcc-6.3.0/include/c++/6.3.0/cstdint:35:0,
                 from cluster.h:6,
                 from type.h:7,
                 from type.cpp:1:
~/gcc-6.3.0/include/c++/6.3.0/bits/c++0x_warning.h:32:2: erreur : #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 \
  ^~~~~
In file included from type.cpp:2:0:
relation.h: Dans la fonction membre « int Relation::getState(const CombNode* const&, const CombNode* const&, const int&, const bool&) »:
relation.h:1172:7: attention : this « if » clause does not guard... [-Wmisleading-indentation]
       if (cmp < 0)  return STATE_N0_BEFORE_N1;
       ^~
relation.h:1173:21: note : ...this statement, but the latter is misleadingly indented as if it is guarded by the « if »
                     return STATE_N0_AFTER_N1;
                     ^~~~~~
relation.h:1178:7: attention : this « if » clause does not guard... [-Wmisleading-indentation]
       if (cmp < 0)  return STATE_N0_AFTER_N1;
       ^~
relation.h:1179:21: note : ...this statement, but the latter is misleadingly indented as if it is guarded by the « if »
                     return STATE_N0_BEFORE_N1;
                     ^~~~~~
makefile:26 : la recette pour la cible « type.o » a échouée
make: *** [type.o] Erreur 1
Run Code Online (Sandbox Code Playgroud)

我不明白的是我使用选项-std = c ++ 11,但我仍然得到"这个文件需要ISO C++ 2011标准的编译器和库支持".我按照错误消息的建议尝试了-std = gnu ++ 11,但这并未改变gcc输出.

M.M*_*M.M 6

取出-ansi开关.如果您提供多个版本切换,则最新版本会取代之前的版本.