stdio.h : No such file or directory
I've just been following a getting started with C tutorial, the first task was to write a "Hello world!" program, the suggested code was:
#include < stdio.h>
void main()
{
printf("\nHello World\n");
}
But when I came to compile it with gcc I got this error:
hello.c:1:21: error: stdio.h : No such file or directory
I Googled and found plenty of forum posts, most suggested installing the build-essential package (I am running Ubuntu 10.4), however this was already installed and at the latest version, I also already had libc6-dev installed which was also suggested in a forum post I'd found.
Instinctively I decided to take an approach that had served me well in the past, it's called "mess with the code" :)
So, this is what worked for me:
#include <stdio.h>
void main()
{
printf("\nHello World\n");
}
The difference? <stdio.h> instead of < stdio.h>
I suspect the error in the first code snippet is obvious but it caught me out and I hope this post saves someone some time!

Comments
Cell
Thu, 07/07/2011 - 02:44
Permalink
Freaking awesome! I've been
Freaking awesome! I've been researching the same error for fairly annoying amount of time.
Cell
Thu, 07/07/2011 - 02:54
Permalink
P.S Thankyou.
P.S Thankyou.
Add new comment