- 论坛徽章:
- 0
|
#include<linux/module.h>
#if defined(CONFIG_SMP)
#define __SMP__
#endif
#if defined(CONFIG_MODVERSIONS)
#define MODVERSIONS
#include <linux/modversions.h>
#endif
#include<linux/kernel.h>
static __init int init_module(void){
printk(KERN_DEBUG "Hello,kernel\n");
return 0;
}
static __exit void cleanup_module(void){
printk(KERN_DEBUG "Good-bye,kernel!\n");
}
我使用的是redhat linux 9.0的操作系统,执行gcc命令:
gcc -D__KERNEL__ -I /usr/src/linux2.4/include -DMODULE -Wall -O2 -c hello.c -o hello.o
出现错误:
hello.c:14:syntax error:before "int"
hello.c:18:syntax error:before "void" |
|