gcc worked perfectly fine until I updated to Ubuntu 16.04 and now when I run:
gcc file.can 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!
5 Answers
First run:
find /usr/include/ -name "stdio.h"If no files are returned, run:
sudo apt install --reinstall build-essentialThat will reinstall any missing files.
2Run:
sudo apt install --reinstall gcc-5.4This reinstalls gcc. Reinstalling sometimes fixes problems.
Install missing library:
sudo apt install libc6-dev Going into the C/C++ Configurations and adding /usr/include/** fixed it for me.
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++/9You have to paste these paths.
Save your .c file and run it as gcc /path in terminal.