1

I tried to use gcc to compile .c file, but the issue occurs as shown,

 fatal error: stdio.h: No such file or directory

# gcc hello.c -o hello
hello.c:1:9: fatal error: stdio.h: No such file or directory
    1 | #include<stdio.h>
      |         ^~~~~~~~~
compilation terminated.

I tried perform find /usr/include/ -name "stdio.h" nothing return.

I tried some methods, they can not work, such as:

sudo apt install --reinstall build-essential
sudo apt install libc6-dev

Even I delete the current GCC and install another version GCC. The same issue occurs. My OS information is as shown:

# uname -a
Linux LS1028ARDB-Ubuntu 5.4.3-rt1 #1 SMP PREEMPT_RT Wed Jul 21 20:29:03 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux

and GCC information:

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)

Is there any method?

HeadzzZ
  • 99
  • 1
  • 8
  • Can you pls add the code and the commands you used to compile your program – Rishikesh Jul 23 '21 at 03:39
  • 1
    Sure, it is as shown: `# gcc hello.c -o hello hello.c:1:9: fatal error: stdio.h: No such file or directory 1 | #include | ^~~~~~~~~ compilation terminated. ` – HeadzzZ Jul 23 '21 at 03:42
  • 1
    @Rishikesh The command is "gcc hello.c -o hello", also I tried "gcc-9 hello.c -o hello". The same issue occurs. – HeadzzZ Jul 23 '21 at 03:44
  • Add a space between #include and < , like this `#include ` – Rishikesh Jul 23 '21 at 03:49
  • @Rishikesh I added a space like your code. But the same issue occurs.. – HeadzzZ Jul 23 '21 at 03:56
  • can you run this and check it out again `sudo apt-get install libc6-dev` and `sudo apt-get install --reinstall build-essential`. For some people adding -get solves the issue. – Rishikesh Jul 23 '21 at 04:13

0 Answers0