1

我尝试使用 gcc 编译 .c 文件,但出现如图所示的问题,

 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.

我试过find /usr/include/ -name "stdio.h"什么都不做。

我尝试了一些方法,它们都不起作用,例如:

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

即使我删除了当前的 GCC 并安装了另一个版本的 GCC。发生同样的问题。我的操作系统信息如图所示:

# 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

和 GCC 信息:

# 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)

有什么方法吗?

4

0 回答 0