"Unresolved inclusion" error with Eclipse CDT for C standard library headers

Derrick Zhang picture Derrick Zhang · Feb 18, 2012 · Viewed 253.9k times · Source

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 ?

Answer

aaaidan picture aaaidan · Aug 13, 2012

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++.)

Screenshot of Eclipse "Project Properties" dialog with "Paths and Symbols" selected. An "add directory path" dialog is overlaid.