Help!How to solve this error-about module.h missing problem
I am a biginner in module programming, and I'm trying to study the module programming by some examples, so I got a simple copy as follow:
//////////////////// //test.c #include <linux/kernel.h> #include <linux/module.h> #if CONFIG_MODVERSIONS==1 #define MODVERSIONS #include <linux/modversions.h> #endif int init_module() { printk("Hello!This is testing module"); return 0; } void cleanup_module() { printk("Sorry!The testing module is unloading now!"); } //end of the program ///////////////////// after I compiled it by command: [root@localhost tian]# gcc -O2 -Wall -DMODULE -D__KERNEL__ -c test.c test.c:2:26: error: linux/module.h: No such file or directory test.c: In function 鈏nit_module? test.c:11: warning: implicit declaration of function 鈖rintk? I have checked for many comments, still not solved and I need your help for that and I will much appreciate of you |
You might be missing a package called linux-headers or kernel-headers depending
on your distro. 'linux/module.h' will be in /usr/include/ A nice thing to do, is to put the name of your distro into your profile here at LQ. Rgds |
Se page 10 of http://lwn.net/images/pdf/LDD3/ch02.pdf
Use a makefile. |
All times are GMT -5. The time now is 04:27 PM. |