Cant find stdio.h header file

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
KabirGandhiok

Cant find stdio.h header file

Post by KabirGandhiok »

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 25
Level 25
Posts: 29615
Joined: Wed Jul 06, 2011 3:58 am

Re: Cant find stdio.h header file

Post by xenopeek »

Did you install build-essential?
Image
KabirGandhiok

Re: Cant find stdio.h header file

Post by KabirGandhiok »

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

Re: Cant find stdio.h header file

Post by KabirGandhiok »

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 25
Level 25
Posts: 29615
Joined: Wed Jul 06, 2011 3:58 am

Re: Cant find stdio.h header file

Post by xenopeek »

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

Re: Cant find stdio.h header file

Post by KabirGandhiok »

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 25
Level 25
Posts: 29615
Joined: Wed Jul 06, 2011 3:58 am

Re: Cant find stdio.h header file

Post by xenopeek »

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

Re: Cant find stdio.h header file

Post by KabirGandhiok »

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

Re: Cant find stdio.h header file

Post by bkorb »

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

Re: Cant find stdio.h header file

Post by bkorb »

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.
WharfRat

Re: Cant find stdio.h header file

Post by WharfRat »

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.
berniewalp
Level 1
Level 1
Posts: 13
Joined: Sat Oct 26, 2019 6:18 pm

Re: Cant find stdio.h header file

Post by berniewalp »

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

Return to “Beginner Questions”