问题描述
我的经验到现在为止,Eclipse的错误发现是非常糟糕的,没有任何解决方案(Tried __ GXX_EXPERIMENTAL_CXX0X __
, -std = c ++在附近的每个设置点,0x
, -std = c ++ 11
我现在不想再搜索一个解决方案了。现在我只想看到真正的编译错误。但是如何完成这个?更新:答案已经过时了。我今天(2014年3月15日)仔细检查:在Eclipse Kepler(Build id 20130614-0229)中,只要
-
在项目>属性>C / C ++构建>设置下添加,然后在工具设置选项卡上添加GCC C ++编译器>其他
-std = c ++ 11
标志, -
然后在窗口>首选项> C / C ++> Build 发现选项卡上的设置选择了CDT GCC内置编译器设置,并添加
-std = c ++ 11 code>标志为命令获取编译器规范。在我的机器上,更改后看起来像这样:
$ {COMMAND} -E -P -v -dD -std = c ++ 11$ {INPUTS}
-
清理并重建您的项目和您的索引(
这可以在我的机器上运行。如果不在你的机器上,那么你可能想给一个镜头:,尽管我不确定这种方法的正确性,也没有必要在我的机器上这样做。截至2014年3月7日,用户,它帮助了他们,而上述方法没有。
My experience until now is, that the error discovery of Eclipse is horribly buggish without any solutions (Tried __GXX_EXPERIMENTAL_CXX0X__
, -std=c++0x
, -std=c++11
in nearby every point of the settings). I am at the point that I dont want to search for a solution no more. Now I just want to see solely real compiler errors. But how to accomplish this?
解决方案 UPDATE: It's been a long time since I posted the original answer and it has become outdated. I double-checked today (Mar 15, 2014): in Eclipse Kepler (Build id 20130614-0229) it is sufficient to
add under Project > Properties > C/C++ Build > Settings then on the Tool Settings tab GCC C++ Compiler > Miscellaneous the -std=c++11
flag,
then under Window > Preferences > C/C++ > Build > Settings on the Discovery tab chose CDT GCC Built-in Compiler Settings and add the -std=c++11
flag to Command to get compiler specs. On my machine it looks like this after the change:
${COMMAND} -E -P -v -dD -std=c++11 "${INPUTS}"
clean and rebuild both your project and your index (Project > C/C++ Index > Rebuild) as Eclipse tends to cache error messages and show them even though they are gone after changing the settings.
This works on my machine for sure. If it doesn't on yours, then you might want to give a shot to this: C++11 full support on Eclipse although I am neither sure about the correctness of this approach nor was it necessary to do it on my machine. As of March 7, 2014 users claim that it helped them whereas the above approach didn't.
这篇关于禁用Eclipse的错误发现。 (Codan假阳性)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!