[英]sys/types.h: No such file or directory
I am trying to compile module but get this error.我正在尝试编译模块但收到此错误。
fatal error: sys/types.h: No such file or directory
compilation terminated.
Here is my module file headers这是我的模块文件头
#include <linux/init.h> // Macros used to mark up functions e.g. __init __exit
#include <linux/module.h> // Core header for loading LKMs into the kernel
#include <linux/device.h> // Header to support the kernel Driver Model
#include <linux/kernel.h> // Contains types, macros, functions for the kernel
#include <linux/fs.h> // Header for the Linux file system support
#include <asm/uaccess.h> // Required for the copy to user function
#include <sys/types.h>
And my Makefile
还有我的
Makefile
obj-m = test.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I have tried to search for this file我试图搜索这个文件
find /usr/include -name types.h
Here are results这是结果
/usr/include/sys/types.h
/usr/include/libr/sdb/types.h
/usr/include/rpc/types.h
/usr/include/i386-linux-gnu/sys/types.h
/usr/include/i386-linux-gnu/asm/types.h
/usr/include/i386-linux-gnu/bits/types.h
/usr/include/linux/iio/types.h
/usr/include/linux/types.h
/usr/include/x86_64-linux-gnu/sys/types.h
/usr/include/x86_64-linux-gnu/asm/types.h
/usr/include/x86_64-linux-gnu/bits/types.h
/usr/include/asm-generic/types.h
/usr/include/c++/5/parallel/types.h
I tried to set it as #include "/usr/include/sys/types.h"
我试图将其设置为
#include "/usr/include/sys/types.h"
but got following error但出现以下错误
/usr/include/sys/types.h:25:22: fatal error: features.h: No such file or directory
compilation terminated.
I am using Kali Linux(Debian)
AMD64 platform我正在使用
Kali Linux(Debian)
AMD64 平台
Linux kali 4.5.0-kali1-amd64 #1 SMP Debian 4.5.5-1kali1 (2016-06-06) x86_64 GNU/Linux
What is wrong ?怎么了? Thanks
谢谢
SOLVED已解决
Sorry this was my fault, I made a typo in type and tried to include sys/types.h
file, but it was not required at all all types are declared in /usr/src/linux-headers-4.5.0-kali1-common/include/linux/types.h
in my case.抱歉,这是我的错,我打错了类型并尝试包含
sys/types.h
文件,但并不是所有类型都在/usr/src/linux-headers-4.5.0-kali1-common/include/linux/types.h
中声明在我的情况下, /usr/src/linux-headers-4.5.0-kali1-common/include/linux/types.h
。 Thanks everyone.谢谢大家。
I had a similar error with Linux Mint我在 Linux Mint 上遇到了类似的错误
fatal error: sys/types.h: No such file or directory
致命错误:sys/types.h:没有这样的文件或目录
Fixed this problem with:修复了这个问题:
sudo apt install libc6-dev
我建议查看gcc
是否正在使用以下命令在您的文件所在的目录中查找头文件:
`gcc -print-prog-name=cc1` -v # for c
您可以将types
头文件添加到您的源中,从这里下载。
Sorry this was my fault, I made a typo in type and tried to include sys/types.h file, but it was not required at all all types are declared in /usr/src/linux-headers-4.5.0-kali1-common/include/linux/types.h in my case.抱歉,这是我的错,我打错了类型并尝试包含 sys/types.h 文件,但并不是所有类型都在 /usr/src/linux-headers-4.5.0-kali1- 中声明在我的情况下,common/include/linux/types.h。 Thanks everyone.
谢谢大家。
您可以通过以下方式解决此问题:
sudo apt-get install libc6-dev-i386
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.