简体   繁体   English

如何在程序中包含内核头文件

[英]How to include kernel headers in a program

I am writing a libnetfilter_queue program.我正在编写一个 libnetfilter_queue 程序。 I am new to linux kernel programming.我是 linux 内核编程的新手。 I need to include linux/skbuff.h, net/checksum.h and many related kernel headers which are not present in /usr/include/linux.我需要包含 linux/skbuff.h、net/checksum.h 和许多相关的内核头文件,这些头文件在 /usr/include/linux 中不存在。 I get following error on compilation我在编译时遇到以下错误

 fatal error: linux/skbuff.h: No such file or directory
 fatal error: net/checksum.h: No such file or directory

试试这个find / -name skbuff.h 2>/dev/null然后当它找到位置时,当你编译你的程序时使用-I/path/to/folder .. 如果它没有找到你没有的头有它!

如果您有定位数据库,请locate linux/skbuff.h

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM