在 Eclipse 中,我可以删除红色错误标记吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6949431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In Eclipse, can I remove the red error markers?
提问by snappy
I need to view source files from a project (C++) that I do not intend to run. Loaded in Eclipse, it has many errors due to missing libraries. Is there a way to tell Eclipse to ignore (or at least not underline in red) those compile errors?
我需要查看我不打算运行的项目 (C++) 中的源文件。在 Eclipse 中加载,由于缺少库,它有很多错误。有没有办法告诉 Eclipse 忽略(或至少不要用红色下划线)那些编译错误?
I want to use eclipse to view the code for the syntax highlighting, parentheses matching, etc.
想用eclipse查看语法高亮、括号匹配等代码
回答by vehk
It's possible to tell Eclipse not to underline the text / show it in the vertical or overview ruler by unchecking all checkboxes in Window -> Preferences -> General -> Editors -> Text Editors -> Annotations -> Errors
可以通过取消选中所有复选框来告诉 Eclipse 不要在文本下划线/在垂直或概览标尺中显示它 Window -> Preferences -> General -> Editors -> Text Editors -> Annotations -> Errors
As you only want to view the code, I'd recommend another editor like Notepad++, Sublime Textor (my personal favourite) vim/gvim. Eclipse is a little bit too 'heavy' for just viewing code.
由于您只想查看代码,因此我推荐另一个编辑器,如Notepad++、Sublime Text或(我个人最喜欢的)vim/gvim。Eclipse 对于仅查看代码来说有点太“重”了。
回答by Diego Pino
If you are using the CDT plugin, which you probably are as you're using Eclipse for a C/C++ project:
如果您正在使用 CDT 插件,您可能在使用 Eclipse 进行 C/C++ 项目时使用它:
Window
->Preferences
->C/C++
->Code Analysis
.- Disable Potential Programming Problemsand Syntax and Semantic Errors.
Window
->Preferences
->C/C++
->Code Analysis
。- 禁用潜在的编程问题以及语法和语义错误。
回答by snappy
You can also just remove the C++ files from the source folders included in the build path.
您也可以从构建路径中包含的源文件夹中删除 C++ 文件。