Search code examples
ceclipsecompiler-errorseclipse-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. I can't get to have my editor update errors & warnings as I edit my .c source files.

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.

Thanks in advance.

EDIT:

In foo.c:

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

Using gccto compile I have:

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.


Solution

  • Without running GCC, these kind of errors (which require a deep semantic analysis with consideration of the compiler settings) cannot be detected.

    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.

    To run GCC on save: in Project > Properties: C/C++ Build, in the tab Behavior check the checkbox Build on resource save (Auto build)