gcc fatal error:stdio.h:No such file or directory

Questions about applications and software
Forum rules
Before you post please read this

gcc fatal error:stdio.h:No such file or directory

Postby lmitcham on Wed Jan 30, 2013 4:39 pm

Hello.c:1:19: fatal error: stdio.h: No such file or directory

I get this error after installing a fresh Linux Mint 14. I have added the correct directory to path and can see it when I type "echo $PATH" in terminal.

I am new to Linux and any advice is welcome.
lmitcham
Level 1
Level 1
 
Posts: 4
Joined: Mon Sep 17, 2012 10:47 am

Linux Mint is funded by ads and donations.
 

Re: gcc fatal error:stdio.h:No such file or directory

Postby bjornmu on Wed Jan 30, 2013 6:11 pm

What were you trying to do, and how does Hello.c look like?
User avatar
bjornmu
Level 3
Level 3
 
Posts: 154
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: gcc fatal error:stdio.h:No such file or directory

Postby SiKing on Wed Jan 30, 2013 6:39 pm

gcc is a compiler, Hello.c is a source file, stdio.h is a resource file.
The PATH is a variable where binary executables are searched for.
The above two items have absolutely nothign to do with each other!

You were apparently trying to compile something. What are you trying to accomplish, and how are you going about it? We need steps to reproduce to be able to help you.
SiKing
Level 5
Level 5
 
Posts: 576
Joined: Mon Sep 29, 2008 10:57 pm
Location: Las Vegas

Re: gcc fatal error:stdio.h:No such file or directory

Postby lmitcham on Thu Jan 31, 2013 8:48 am

I am attempting to get my feet wet with gcc and linux. I was simply creating a simple program, using Kate, from a tutorial. The 'Hello.c' program file is :

Code: Select all
#include <stdio.h>

void main
{
    printf("Hello World\n");
}


I created a directory named "Temp" under >home>mydir>Projects, and stored Hello.c there.

If I open terminal and go to the "Temp" directory and type "gcc Hello.c -o hello1", the response is
"fatal error: stdio.h: No such file or directory"

My first thought was that stdio.h was not in the PATH, so I added it and checked that the PATH was updated by typing
"echo $PATH"

Another attempt to compile produced the same error message.

That is where I am now. I am hopefully missing something simple.
lmitcham
Level 1
Level 1
 
Posts: 4
Joined: Mon Sep 17, 2012 10:47 am

Re: gcc fatal error:stdio.h:No such file or directory

Postby bjornmu on Thu Jan 31, 2013 12:38 pm

The file should be located under /usr/include and this is the default location so you shouldn't need to tell gcc that. You may first want to double check that you have /usr/include/stdio.h available.

BTW your program won't compile in any case since you've forgotten () after the name of main(). :) But you didn't get that far.
User avatar
bjornmu
Level 3
Level 3
 
Posts: 154
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway


Return to Software & Applications

Who is online

Users browsing this forum: Google [Bot] and 20 guests