Cant find stdio.h header file

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Locked
KabirGandhiok
Level 1
Level 1
Posts: 29
Joined: Thu Sep 10, 2015 9:37 am

Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 5:29 am

Hello,
I'm learning C on my Mint 17.2 Cinnamon 64 bit, but for some reason gcc cannot find the stdio.h header file.
This is the error I get -

kabir@kabir-G50-80 ~/Programming/C $ gcc helloworld.c -o hello
helloworld.c:1:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.


And here is the program I want to compile -

#include <stdio.h>
#include <stdlib.h>

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



I can't see where I've gone wrong. Any help regarding this would be very helpful.
Thanks!

PS: I was under the impression that all these header files came preinstalled in mint as I didn't face this problem when I was learning C on ubuntu. I checked /usr/include and couldn't find stdio.h unless it is located in some other folder or sub folder.

User avatar
xenopeek
Level 24
Level 24
Posts: 24137
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Cant find stdio.h header file

Post by xenopeek » Sat Sep 19, 2015 5:37 am

Did you install build-essential?
Image

KabirGandhiok
Level 1
Level 1
Posts: 29
Joined: Thu Sep 10, 2015 9:37 am

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 5:40 am

Do I have to install build-essentials? I thought all these header files that gcc requires to compile came pre-installed?

KabirGandhiok
Level 1
Level 1
Posts: 29
Joined: Thu Sep 10, 2015 9:37 am

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 5:43 am

I just found stdio.h installed in this path -
/usr/lib/syslinux/com32/include/stdio.h

How do I instruct gcc to pick the header file from this path?
Thanks!

User avatar
xenopeek
Level 24
Level 24
Posts: 24137
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Cant find stdio.h header file

Post by xenopeek » Sat Sep 19, 2015 5:46 am

xenopeek wrote:Did you install build-essential?
I hate repeating myself, but if you didn't install it then install it.
Image

KabirGandhiok
Level 1
Level 1
Posts: 29
Joined: Thu Sep 10, 2015 9:37 am

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 6:39 am

xenopeek wrote:
xenopeek wrote:Did you install build-essential?
I hate repeating myself, but if you didn't install it then install it.
My apologies. I did not intend to refute you. I was only curious as to why gcc doesn't recognize stdio.h from the path - /usr/lib/syslinux/com32/include

Since I'm new here, and I do not know much of the Linux file system and the logic behind it and neither do I know much of C or GNU, which is probably why I was curious.

Installing build-essentials has fixed this problem, and I thank you for that, however I would still like to know why installing build-essentials is important when stdio.h exists in the path I listed above (/usr/lib/syslinux/com32/include). Again, I'm just curious but I will go read about this on Google.

Thanks!

Forgive me if my question was stupid, ignorant or a test of your patience.

User avatar
xenopeek
Level 24
Level 24
Posts: 24137
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Cant find stdio.h header file

Post by xenopeek » Sat Sep 19, 2015 6:59 am

Not a stupid question, but yes you need build-essential (no s at the end) to get the complete gcc compiler stack installed. That's standard across all Debian and Ubuntu based distros.

The stdio.h file you found comes from a syslinux package, which is a collection of boot loaders. I don't know what it's for but likely a minimal implementation of stdio for use in the resource constrained boot loader. This is not the stdio.h file you are searching for :wink:
Image

KabirGandhiok
Level 1
Level 1
Posts: 29
Joined: Thu Sep 10, 2015 9:37 am

Re: Cant find stdio.h header file

Post by KabirGandhiok » Sat Sep 19, 2015 7:30 am

xenopeek wrote:Not a stupid question, but yes you need build-essential (no s at the end) to get the complete gcc compiler stack installed. That's standard across all Debian and Ubuntu based distros.

The stdio.h file you found comes from a syslinux package, which is a collection of boot loaders. I don't know what it's for but likely a minimal implementation of stdio for use in the resource constrained boot loader. This is not the stdio.h file you are searching for :wink:
Thank you very much for responding and letting me know, this helped greatly :)

bkorb
Level 1
Level 1
Posts: 14
Joined: Thu Dec 17, 2015 2:22 pm

Re: Cant find stdio.h header file

Post by bkorb » Thu Dec 17, 2015 2:24 pm

Now that it is much too late to do anything, why, exactly, would anybody make it so that GCC installs by default but the absolutely necessary headers do not?

bkorb
Level 1
Level 1
Posts: 14
Joined: Thu Dec 17, 2015 2:22 pm

Re: Cant find stdio.h header file

Post by bkorb » Thu Sep 28, 2017 2:25 pm

Code: Select all

sudo apt install build-essentials
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package build-essentials
Hmm. Too easy for native English users to add that "s". Oh, well....Still, its addition should be more automatic.

User avatar
WharfRat
Level 21
Level 21
Posts: 13374
Joined: Thu Apr 07, 2011 8:15 pm

Re: Cant find stdio.h header file

Post by WharfRat » Thu Sep 28, 2017 3:26 pm

It's build-essential not build-essentials
bkorb wrote:Now that it is much too late to do anything, why, exactly, would anybody make it so that GCC installs by default but the absolutely necessary headers do not?
There are some applications, virtual box as one example, that require modules to be compiled for each kernel therefore the need for a minimal GCC installation.
ImageImage

berniewalp
Level 1
Level 1
Posts: 4
Joined: Sat Oct 26, 2019 6:18 pm

Re: Cant find stdio.h header file

Post by berniewalp » Sat Oct 26, 2019 6:20 pm

Thanks. I needed that build-essential too. I, too, appended the "s"

Locked

Return to “Newbie Questions”