gcc can not find stdio.h 'no such file'

Asked by Cliffm

Hello my name is Cliff
The GCC has always worked before upgrading to Ubuntu 12.10.

now it tells me stdio.h no such file.
The test file is std hello.c file

#include < stdio.h >

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

!gcc hello.c
hello.c:1:21: fatal error: stdio.h : No such file or directory
compilation terminated.

shell returned 1

installed build-essential

cliffm@cjm:~$ sudo apt-get install build-essential
[sudo] password for cliffm:
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
build-essential set to manually installed.

Still will not compile?

Thanks for any help

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1

try to install

libc6-dev

Revision history for this message
Cliffm (c2mcatee) said :
#2

Hi Marco

This is the result.

sudo apt-get install libc6-dev
[sudo] password for cliffm:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#3

#include "stdio.h"

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

Try this...

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#4

compile with

gcc -o hello -ansi hello.c

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#5

Run with

./hello

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#6

remove spaces in <stdio.h> : try this code...

#include <stdio.h>

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

Save to hello.c, then compile and run with this row:

gcc -o hello -ansi hello.c; ./hello

Revision history for this message
Cliffm (c2mcatee) said :
#7

#include "stdio.h"

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

:!gcc -o hello -ansi hello.c
hello.c:1:21: fatal error: stdio.h : No such file or directory
compilation terminated.

shell returned 1

:!./hello
/bin/bash: ./hello: No such file or directory

shell returned 127

Revision history for this message
Cliffm (c2mcatee) said :
#8

Marco
This worked
What is different in Ubuntu12.10 than there was in 12.04 and earlier?
So adding the -ansi seems to be the answer.
Are there any other changes I should make?

Thanks for the help
Cliff

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#9

This is c/ompilingworking without -ansi flag:

#include <stdio.h>

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

Save to hello.c, then compile and run with this row:

gcc -o hello hello.c; ./hello

Revision history for this message
Cliffm (c2mcatee) said :
#10

Marco
run without ansi flag

#include <stdio>

void main()
{
    printf("\nHello World\n")
}

:!gcc -o hello hello.c
hello.c:1:18: fatal error: stdio: No such file or directory
compilation terminated.

shell returned 1

Revision history for this message
Best marcobra (Marco Braida) (marcobra) said :
#11

Please note:

#include <stdio.h>

not

#include <stdio>

Revision history for this message
Cliffm (c2mcatee) said :
#12

Also included ';'

#include <stdio.h>

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

!gcc -o hello hello.c

:!./hello

Hello World

shell returned 13

That worked
Thanks Marco
I was following a C tutorial book and it recommended 'gcc hello.c' only.
Thanks again

Revision history for this message
lohi (lohiram) said :
#26

I'm trying to compile a program in C on OS X 10.9 with GCC 4.9 (experimental). For some reason, I'm getting the following error at compile time:

gcc: fatal error: stdio.h: No such file or directory
I then tried a simple Hello World program:

#include <stdio.h>

int main(int argc, const char *argv[])
{
    printf("Hello, world!");
    return 0;
}
Again, upon running gcc -o ~/hello ~/hello.c, I got the same error. I'm using an experimental version of gcc, but it seems implausible that there would be a release which generated errors upon importing stdio. What could be causing this issue, and how can it be fixed?
https://myboyapk.fun/

Revision history for this message
candymika (candymika) said :
#28

Your article is awesome. I enjoyed reading your article. This is really a great document for me. I've bookmarked it and I'm looking forward to reading new posts. Please continue to uphold!
https://littlealchemy.io

Revision history for this message
william sonalford (williamsonalford) said :
#29

Oh, there is a mistake in your compile, this error a lot of people make #include <stdio.h>
https://supermario-bros.co

Revision history for this message
lukeshaw (lukeshaw) said :
#30

Please note:

#include <stdio.h>

not

#include <stdio>
https://nytimes-spellingbee.com

Revision history for this message
alishakihn (alishakihn) said (last edit ):
#31

I have played a lot of games, but this is the best one Flappy Bird. wonderful. https://flappy-bird.io

Revision history for this message
Snap Tube (snaptubema) said :
#32

Your passion for the subject shines through in every word. It's evident that you genuinely care about the topic you're discussing. https://futbollibretvhd.com/

Revision history for this message
Emma Charlotte (emmac21) said :
#33

I am not much into coding but thanks for sharing the info for other coders out there!
https://www.theleathercity.com/product/yellowstone-beth-dutton-leopard-jacket/

Revision history for this message
Is Iptv Legal (isiptvlegal) said :
#34

<a href="https://rdphostings.com/blog/is-iptv-legal">Is IPTV Legal</a>,IPTV (Internet Protocol Television) is legal in most parts of the world. However, not all IPTV services are legal. In order to be legal, an IPTV service must have the proper licenses for the content it is streaming. Illegal IPTV services do not have these licenses, and they are often infringing on copyright laws.

Revision history for this message
Fabrizio Bianchi (aitoolxpedia) said :
#35

I'm try to many time for my website (https://aitoolxpedia.com/best-ai-boyfriend-app/)
I'm trying to compile a program in C on OS X 10.9 with GCC 4.9 (experimental). For some reason, I'm getting the following error at compile time:

gcc: fatal error: stdio.h: No such file or directory
I then tried a simple Hello World program:

#include <stdio.h>

int main(int argc, const char *argv[])
{
    printf("Hello, world!");
    return 0;
}
And get only this!