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

前端 未结 14 2154
甜味超标
甜味超标 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:05

    An error I had configuring Paths and Symbols is that initially I configued the include paths for a different language. I'm working with CDT and Cygwin gnu C++. So you must configure symbols and paths under GNU C++ language.

    0 讨论(0)
  • 2020-11-28 05:12

    just adding to the knowledge base, i just did this on win7 with cygwin.

    this is what seems to work for me.

    include paths for c:

    D:\dev\cygwin\lib\gcc\i686-pc-cygwin\3.4.4\include
    D:\dev\cygwin\usr\include
    

    include paths for c++:

    D:\dev\cygwin\lib\gcc\i686-pc-cygwin\3.4.4\include
    D:\dev\cygwin\lib\gcc\i686-pc-cygwin\3.4.4\include\c++
    D:\dev\cygwin\usr\include
    

    this gets me a clean compile of hello world.

    0 讨论(0)
  • 2020-11-28 05:13

    In ADT I did the following:

    1. right click on the project and select Properties
    2. expand C/C++ General and select Preprocessor Include Paths, Macros etc.
    3. select CDT User Setting Entries
    4. select Add... from the right hand menu
    5. In the Add Include Directory change Project Path to File System Path
    6. Browse to the directory that contains your include files
    7. stir and repeat as needed
    0 讨论(0)
  • 2020-11-28 05:15

    I m using eclipse based CodeWarrior IDE for embedded projects and i have just solved this problem by deleting and adding again the source adresses to Project Properities->C/C++ General->Path and Sybols-> Include Directories. This means that there lots of reason to take "Unresolved inclusion:" message and there r lots of solution too.

    0 讨论(0)
  • 2020-11-28 05:18

    I'm working with multiple cross compiler configurations, where I need to use different locations for the STD header files (and other environment variables).

    The solution was to set up the indexer so it uses the active configuration.
    Unfortunately due to some bug in eclipse, the option isn't stored locally, so you have to use the workspace configuration if you want to save the configuration when you open eclipse again.

    Window -> Preferences -> C/C++ -> Indexer -> Use active build configuration

    This will make eclipse use the right compiler that is set with the project's active Cross GCC configuration.

    0 讨论(0)
  • 2020-11-28 05:19

    I'm using Eclipse with Cygwin and this worked for me:

    Go to Project > Properties > C/C++ General > Preprocessor Includes... > Providers and select "CDT GCC Built-in Compiler Settings Cygwin [Shared]".

    0 讨论(0)
提交回复
热议问题