关闭eclipse错误(这不是真的错误) [英] Turn off eclipse errors (that arent really errors)

查看:1116
本文介绍了关闭eclipse错误(这不是真的错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

禁用Eclipse的错误发现。 (c ++ 11误判)


使用GCC 4.8 / Clang 3.3 C ++支持远远超过Eclipse正在使用语法检查(在功能支持方面),Eclipse正在将许多事情标记为实际上是有效代码的错误(模板别名恰好是我的主要问题,但也有其他问题) 。



当我编译(或尝试反正有一些问题,请参阅这里为更多)无论编译器碰巧做的工作做它的工作,并且它的错误传播通过,但它说的代码是好的是仍然强调(分别为错误和警告的红色和金色蜘蛛),这使得很难看到正在发生什么。



有没有办法摆脱这些错误/警告?



更好的办法是只有在编译尝试之后才能移除警告,并且只要代码的相关部分不改变,但仍然让它们启用。



(实际上最好的是Eclipse的插件,支持所有,或至少更多的C ++ 11比Juno

更新:很长时间以来我发布的原始答案,它已经变得过时。我今天(2014年3月15日)仔细检查:在Eclipse Kepler(Build id 20130614-0229)中,足以




  • 工具 c> -std = c ++ 11 标志,


  • > 选项卡上选择 CDT GCC内置编译器设置并添加 -std = c ++ 11 code>标志到命令以获取编译器规格。在我的机器上,更改后看起来像这样:



    $ {COMMAND} -E -P -v -dD -std = c ++ 11$ {INPUTS}


  • 清除并重建您的项目


>

这在我的机器上可以正常工作。如果它不在你的机器上,那么你可能想要拍摄这个: C++11 Eclipse上的完全支持虽然我既不确定这种方法的正确性,也不需要在我的机器上这样做。自2014年3月7日起,用户声明它帮助他们,而上述方法没有。






原始讯息,现已过期:





这些虚假错误来自 Codan 。整个事情是因为Codan和编译器对C ++的不同理解 Codan是 buggy



可能的解决方法


  1. 点击项目属性,然后点击C / C ++常规>代码分析>语法错误和语义错误,并取消选择您得到的错误错误。缺点:您最有可能最终会逐一停用大多数错误和警告,这是非常讨厌的。


  2. 完全停用静态分析> C / C ++常规>代码分析>语法和语义错误。


它们都不是解决方案但至少您仍然可以使用Eclipse IDE。




Possible Duplicate:
Disable Eclipse’s error discovery. (c++11 false positives)

With GCC 4.8/Clang 3.3 C++ support so far ahead of what Eclipse is doing with syntax checking (in terms of feature support), Eclipse is marking many things as errors that are actually valid code (template aliasing happens to be my main problem, but there are other issues as well).

When I compile (or attempt to anyway, having some issues, see here for more) whatever compiler happens to be doing the work does its job, and its errors get propagated through, but the code that it says is OK is still underlines (red and gold spiders for errors and warnings respectively), which makes it much harder to see what is going on.

Is there a way to get rid of these errors/warnings?

Even better would be a way to get rid of warnings only after compile attempt, and for as long as the relevant parts of the code don't change, but still leave them enabled in general.

(Actually the best would be a plugin for Eclipse that supports all, or at least more of C++11 than Juno does by itself, but I can't seem to find that)

解决方案

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.


The original post, now outdated:

These bogus errors come from Codan. The whole thing is because Codan and the compiler have different understanding of C++ and Codan is buggy.

Possible workarounds

  1. Click on the project properties, then C/C++ General > Code Analysis > Syntax and Semantic Errors and deselect whatever false errors you are getting. Drawback: you will most likely end up disabling most of the errors and warning one by one, which is quite annoying.

  2. Disable the static analysis completely at C/C++ General > Code Analysis > Syntax and Semantic Errors. You won't get the true errors from Codan but only later from the compiler.

None of them is a solution but at least you can still use the Eclipse IDE.

这篇关于关闭eclipse错误(这不是真的错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆