如何添加Ubuntu 中没有头文件吗?

如何添加Ubuntu 中没有头文件吗?

我使用的是 Ubuntu 18.04,内核是 4.15。当我在源代码中包含头文件时<linux/timer.h>,找不到头文件: 。然后我通过在 gcc 的命令行中添加来fatal error: linux/timer.h: No such file or directory包含源文件。但是,由于缺少另一个头文件,又出现了另一个错误:。现在,我不知道如何包含,因为它们太多了。timer.h-I /usr/src/linux-headers-4.15.0-91/includefatal error: asm/linkage.h: No such file or directorylinkage.h

wpf@wpf-KLV-WX9:~/Desktop/BDFuzzer$ sudo find / f -name "linkage.h" /usr/src/linux-headers-4.15.0-91/include/linux/linkage.h /usr/src/linux-headers-4.15.0-91/include/asm-generic/linkage.h /usr/src/linux-headers-4.15.0-91/arch/metag/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/arm64/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/m32r/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/frv/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/nios2/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/tile/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/alpha/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/ia64/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/parisc/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/c6x/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/score/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/blackfin/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/m68k/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/arc/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/hexagon/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/arm/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/openrisc/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/s390/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/riscv/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/mips/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/mn10300/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/x86/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/sh/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/unicore32/include/asm/linkage.h /usr/src/linux-headers-4.15.0-91/arch/powerpc/include/asm/linkage.h 由于我使用的是 x86-64 机器,所以我选择了/usr/src/linux-headers-4.15.0-91/arch/x86/include/asm/linkage.h,但也出现了许多错误。

我也尝试过 apt-get install libc-devapt-get install build-essentialsudo apt-get install linux-headers-$(uname -r),但都没有用。有人能告诉我如何正确使用吗?

相关内容