编译错误:“stdint.h:没有那个文件或目录”

3
尝试构建内核时,我遇到了这个错误。
/usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h:9:26: error: no include path in which to search for stdint.h
 # include_next <stdint.h>

当我查看 /usr/lib/gcc/x86_64-linux-gnu/7/ 时,只有一个 stdint.h 文件,而在 include-fixed 目录下,有 limit.h 和 syslimit.h 两个文件。

你是使用交叉编译器还是操作系统的“标准”gcc版本? - bruno
在我的操作系统(Ubuntu 18.04)中,gcc版本为7.5.0,在该项目中使用的是gcc 7。 - rivto
1个回答

1

最后,我通过添加KBUILD_CFLAGS += $(call cc-option,-ffreestanding)解决了这个问题。

这将限制gcc使用标准的stdint stdint-gcc.h


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接