How to include kernel headers in a program
12,150
try this find / -name skbuff.h 2>/dev/null
then when it finds the location use the -I/path/to/folder
when you compile your program.. If it doesn't find the header you don't have it!
Comments
-
adnan kamili almost 2 years
I am writing a libnetfilter_queue program. I am new to linux kernel programming. I need to include linux/skbuff.h, net/checksum.h and many related kernel headers which are not present in /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
-
shkschneider over 11 yearsfind /usr [...] should be enough ^^
-
adnan kamili over 11 yearsI added the path /usr/src/linux-headers-3.2.0-32/include/ but i get following error : /usr/src/linux-headers-3.2.0-32/include/linux/bitops.h:22:24: fatal error: asm/bitops.h: No such file or directory
-
pyCthon over 11 yearsdo you know how to add a directory to your path?
-
adnan kamili over 11 yearsg++ -Wall -I /usr/src/linux-headers-3.2.0-32/include/ -o filter -lnetfilter_queue
-
pyCthon over 11 yearsthats a no, type $PATH in terminal copy paste that then go to your home directory and type
vi .bashrc
add what your copied and add your desired directory to include it in the search path see if that works for examplePATH=$PATH:/usr/src/linux-headers-3.2.0-32/include/:$HOME/bin