“Unresolved inclusion” error with Eclipse CDT for C standard library headers

前端 未结 14 2151
甜味超标
甜味超标 2020-11-28 04:18

I set up CDT for eclipse and wrote a simple hello world C program:

#include 

int main(void){
    puts(\"Hello, world.\");
    return 0;
}
         


        
14条回答
  •  有刺的猬
    2020-11-28 05:03

    Normally, Eclipse should be able to automatically resolve the standard include files. It does this by calling gcc and asking its configuration. Most likely Eclipse is not finding your gcc (or at least not the version you use for compiling).

    Instead of specifying all the standard include paths in project settings, you probably want to make sure Eclipse finds gcc. Add the directory where gcc is found to PATH environment variable before starting Eclipse.

    If you want different projects to use different compilers, then you might want to tweak the discovery options. These are hidden by default, so first enable them from Window > Preferences > C/C++ > Property Pages Settings > Display "Discovery Options" page. Then you can find them under C/C++ Build > Discovery Options in project properties.

提交回复
热议问题