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

Questions about applications and software
Forum rules
Before you post please read how to get help

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: 160
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: 160
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

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

Postby JasonMel on Thu Sep 11, 2014 5:37 pm

I have the same problem, and I found my stdio.h in a completely different directory from /usr/include. How do I tell the system where my header files are? And why would my Mint install not know already?
JasonMel
Level 1
Level 1
 
Posts: 5
Joined: Thu Sep 11, 2014 5:26 pm
Location: United States

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

Postby Zetor895 on Tue Sep 23, 2014 8:25 am

JasonMel wrote:I have the same problem, and I found my stdio.h in a completely different directory from /usr/include. How do I tell the system where my header files are? And why would my Mint install not know already?

I am also interested in this. I found stdio.h in /usr/lib/syslinux/com32/include/ directory. Is it OK if i make a symbolic link from here to /usr/include?
Thanks in advance.
EDIT: it seems not. I got an error message during copiling:
~ $ make hello
cc hello.c -o hello
In file included from hello.c:1:0:
/usr/include/stdio.h:8:26: fatal error: klibc/extern.h: No such file or directory
#include <klibc/extern.h>
^
compilation terminated.
make: *** [hello] Error 1

EDIT2:
This solved the issue:
Code: Select all
 sudo apt-get install build-essential


but I am still interested why the symlink did not work?
Linux Mint 17 Cinnamon 64. AMD Phenom II X6, MSI Radeon HD7750 2 GB, Asus MB., 4GB RAM.
Zetor895
Level 1
Level 1
 
Posts: 28
Joined: Sun May 25, 2014 8:13 am

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

Postby bjornmu on Tue Sep 30, 2014 5:10 pm

Probably because that other stdio.h is something completely different from the standard stdio.h and it meant to be used in a different context. No I don't know *what* that is, except it's not the same....
User avatar
bjornmu
Level 3
Level 3
 
Posts: 160
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: No registered users and 33 guests