I set up CDT for eclipse and wrote a simple hello world C program:
#include <stdio.h> int main(void){ puts("Hello, world."); return 0; }
The program builds and runs correctly, but eclipse keeps showing this yellow question mark by the side of inclusion statement that says "Unresolved inclusion: <stdio.h>"
when I put mouse over it.
It doesn't affect running of the program but I find it rather annoying.
Does anyone have any idea how to remove it?
expand C/C++ General and select Preprocessor Include Paths, Macros etc. select CDT User Setting Entries. select Add... from the right hand menu. In the Add Include Directory change Project Path to File System Path.
"unresolved inclusion" means the file can't be found. This means the directory containing it hasn't been specified to CDT or it has been misspelled. If spelled correctly, normally you would specify the path with Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc.
I found these answers (including the accepted one) somewhat cryptic.
For me, I had to add the path where stdio.h is located (as @ardnew said). In Eclipse, you open the Properties of your project, expand "C/C++ General" and select "Paths and Symbols".
Make sure you have added the include
dir for each language you are using. (In my case, I needed to just add it to GNU C++.)
The compiler Eclipse is using is able to resolve the symbols just fine, so the code will compile fine.
But the code-completion/indexer or preprocessor Eclipse is using doesn't know where stdio.h
exists.
You need to specify the filesystem path where stdio.h
is located.
The Eclipse documentation describes this in several sections for the compiler:
And if the code-completion/indexer or preprocessor specifically also cannot locate stdio.h
:
The exact location of stdio.h
will depend on the system you are intending to write the code for. If you are writing code for the same system you are running Eclipse on, then the standard location is /usr/include/stdio.h
for Linux, macOS, Cygwin, etc.
If you are cross-compiling for a separate/remote target system (e.g. Android, Raspberry Pi, STM32), then it will be located somewhere in the SDK you installed for that system. You will need to refer to that particular SDK documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With