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

Asked by Cliffm on 2012-12-08

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:
2012-12-09
Last query:
2012-12-09
Last reply:
2012-12-09

This question was reopened

try to install

libc6-dev

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.

#include "stdio.h"

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

Try this...

compile with

gcc -o hello -ansi hello.c

Run with

./hello

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

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

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

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

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

Please note:

#include <stdio.h>

not

#include <stdio>

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

mimi20 (mimi20) said : #13

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

:!gcc -o hello hello.c https://sarkariresult.onl/ https://pnrstatus.vip/ https://192168ll.onl/

kiranwala (kiranwala) said : #15

The accepted answer no longer works. When running the command xcode-select --install it tells you to use "Software Update" to install updates.

In this link is the updated method:
https://pinoychannelflix.su
Open a Terminal and then:

cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg
This will open an installation Wizard.

denial gonjalvish (denial234) said : #16

#include<stdio.h>
#include<conio.h>
void main()
{
      printf("Hello World");
      getch();
}

https://customersurvey.onl/
https://mcdvoice.today/
https://apkhubs.com/
https://surveysguy.com/

denial gonjalvish (denial234) said : #17

#include<stdio.h>
#include<graphics.h>
void main()
{
          int a;
           printf("\n Enter your Lucky number");
          scanf("%d",&a);
getch();

}

https://alternativesoft.info/ https://panda-express-feedback.com/ https:// 192-168-1-1ip.solutions/

Varun Gangawane (shrutib) said : #18

There is system level file stdio.h, this is why stdio.h cannot be found.

The problem in:

inverse.c:1:10: fatal error: stdio.h: No such file or directory
#include <stdio.h>
      ^~~~~~~~~
compilation terminated.
is:

Refer to /usr/local/Cellar/gcc@4.9/4.9.4_1/lib/gcc/4.9/gcc/x86_64-apple-darwin17.3.0/4.9.4/include/ssp/stdio.h

#ifndef _SSP_STDIO_H
#define _SSP_STDIO_H 1

#include <ssp.h>
#include_next <stdio.h>
#include_next means include next one name stdio.h, this one is just a guider.

Give a deprecated shot. cp all files in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include to /usr/local/Cellar/gcc@4.9/4.9.4_1/lib/gcc/4.9/gcc/x86_64-apple-darwin17.3.0/4.9.4/include-fixed, gcc-4.9 will work again.

https://lotterysambadtodays.in/lottery-sambad-result-11-55-am/
https://lotterysambadtodays.in/lottery-sambad-result-04-00-pm/

Gabriel Hope (1hope) said : #19

#include<stdio.h>
#include<conio.h>
void main()
{
      printf("Hello World");
      getch();
}

https://techfrog.info/rice-purity-test/
https://techrally.info/rice-purity-test/
https://yeszone.info/rice-purity-test/
https://webdeeply.com/rice-purity-test/

John Markos (johnmarkos) said : #20

Thanks for this amazing code
Refer to /usr/local/Cellar/gcc@4.9/4.9.4_1/lib/gcc/4.9/gcc/x86_64-apple-darwin17.3.0/4.9.4/include/ssp/stdio.h

#ifndef _SSP_STDIO_H
#define _SSP_STDIO_H 1

https://www.relaxtv.xyz/cyberflix-tv-apk/
https://cyberflix.info/
https://mediaboxhdapk.me/
https://catmouse.vip/
https://www.aostv.me/