简体   繁体   English

Eclipse CDT在保存时不显示错误和警告

[英]Eclipse CDT doesn't show errors & warnings on save

Disclaimer : Nothing to do with this question 免责声明 :与这个问题无关

Hello there, 你好,

I'm having an issue in Eclipse CDT. 我在Eclipse CDT中遇到问题。 I can't get to have my editor update errors & warnings as I edit my .c source files. 编辑.c源文件时,我无法让编辑器更新错误和警告。

In order to get errors to show up, I need to build manually all the time. 为了显示错误,我需要一直手动构建。 Am I missing something ? 我想念什么吗?

I have tried all the options at my disposal within the CDT config panel. 我已经尝试了CDT配置面板中所有可用的选项。

Thanks in advance. 提前致谢。

EDIT : 编辑

In foo.c : foo.c

int main() {
    return 1 << 40 - 1;
}

Using gcc to compile I have: 使用gcc进行编译,我有:

foo.c: In function ‘main’:
foo.c:2:11: warning: left shift count >= width of type [-Wshift-count-overflow]
 return 1 << 40 - 1;

Which appears correctly after I build the project in eclipse, but doesn't show otherwise. 在eclipse中构建项目后,它可以正确显示,但不会显示其他内容。

Without running GCC, these kind of errors (which require a deep semantic analysis with consideration of the compiler settings) cannot be detected . 如果不运行GCC, 则无法检测到 此类错误 (需要进行深度语义分析并考虑编译器设置)。

By default, on save, the file will only be scanned/parsed for indexing (used for navigation and C/C++ Search) and for detecting syntax errors like returns instead of return . 缺省情况下,保存,该文件将仅被扫描/解析索引(用于导航和C / C ++搜索)和用于检测像语法错误returns ,而不是return

To run GCC on save: in Project > Properties: C/C++ Build , in the tab Behavior check the checkbox Build on resource save (Auto build) 要在保存时运行GCC,请执行以下操作:在“ 项目”>“属性:C / C ++构建”中 ,在“ 行为选项卡中 ,选中“ 在资源保存时构建(自动构建) ”复选框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM