Search code examples
clinuxubuntueclipse-cdt

Eclipse on ubuntu can't resolve simple libraries like stdio


I used the following code code and it gave me this warning: "Unresolved inclusion <stdio.h>"

#include <stdio.h>

int main(void)
{
    printf("Hello world!\n");
return 0;
}

I tried reseting eclipse, add path like "\usr\includes".


Solution

  • stdio is a standard header file that would be installed into /usr/include on a standard Ubuntu install. This location is normally within the $PATH environment variable and would normally be picked up by default (well, at least it has on my installs...).

    Make sure /usr/include is in the library search path within the Eclipse project settings. You have stated \usr\includes in your question which isn't correct, both in format and in name.

    Once you have /usr/include in the search path, if it still fails then go to a terminal window and type:

    find /usr/include/ -name "stdio.h"
    

    If it's not there, you need to install/reinstall build-essentials with:

    sudo apt-get install --reinstall build-essential