8

gcc worked perfectly fine until i updated to ubuntu 16.04 and now when ran
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 was still in /usr/include/stdio.h

Please Help!

  • run gcc --version – George Udosen Jul 17 '17 at 21:40
  • gcc version is (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 – Camden Jul 17 '17 at 21:42
  • Now run sudo apt update then sudo apt dist-upgrade and lets see what happens – George Udosen Jul 17 '17 at 21:45
  • Am I getting this right: the proposed solution is doing a dist upgrade? – Chiffa Jul 19 '18 at 16:02
6

Run:

sudo apt install --reinstall gcc-5.4

This reinstalls gcc. Reinstalling sometimes fixes problems.

| improve this answer | |
15

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.

| improve this answer | |
  • 1
    sudo apt install --reinstall build-essential fixed the error for me, thanks! – Vikram Hosakote May 20 '19 at 17:56
  • I added "-get" after "apt" to be "sudo apt-get install --reinstall build-essential", so that the computer executes the command successfully. Thank you. Peace. – masarapmabuhay Jul 12 at 1:42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.