C stdio.h no such file or directory

gcc worked perfectly fine until I updated to Ubuntu 16.04 and now when I run:

gcc file.c

an error shows up:

file.c:1:18: fatal error: stdio.h: No such file or directory
compilation terminated.

I checked if stdio.h was there and it still was in /usr/include/stdio.h. Please help!

0

5 Answers

First run:

find /usr/include/ -name "stdio.h"

If no files are returned, run:

sudo apt install --reinstall build-essential

That will reinstall any missing files.

2

Run:

sudo apt install --reinstall gcc-5.4

This reinstalls gcc. Reinstalling sometimes fixes problems.

0

Install missing library:

sudo apt install libc6-dev

Going into the C/C++ Configurations and adding /usr/include/** fixed it for me.

1

Go to the View tab if you are using VSCode. Search for C/C++ edit configuration(UI). Copy/paste these paths to the include path section of the configuration.

/usr/include/
/usr/include/x86_64-linux-gnu
/usr/include/linux
/usr/include/c++/9/tr1
/usr/include/c++/9

You have to paste these paths.

Save your .c file and run it as gcc /path in terminal.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like