我已经在centos上安装了kernel devel,仍然找不到kernel头

# yum install kernel-devel
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors....net
 * extras: ...
 * updates: mirrors.....net
Package kernel-devel-2.6.32-642.15.1.el6.x86_64 already installed and latest version

但是gcc仍然没有找到头文件:
# cat testkmem.c
#include<sys/types.h>
#include<sys/kmem.h>
int main(){

    return 0;
}

# gcc testkmem.c
testkmem.c:2:21: error: sys/kmem.h: No such file or directory

如何解决这个编译问题,需要额外的百胜包吗?

最佳答案

你知道定位命令吗?

$ locate kmem.h
/usr/src/kernels/3.10.0-514.10.2.el7.x86_64/include/config/memcg/kmem.h
/usr/src/kernels/3.10.0-514.10.2.el7.x86_64/include/trace/events/kmem.h

:-),我认为你的路径有错误。

10-08 03:56