|
|
代码很简单- #include <linux/init.h>
- #include <linux/module.h>
- MODULE_LICENSE("DUAL BSD/GPL");
- static int hello_init(void)
- {
- printk(KERN_ALERT"hello,world\n");
- return 0;
- }
- static void hello_exit(void)
- {
- printk(KERN_ALERT"Good bye,cruel world\n");
- }
- module_init(hello_init);
- module_init(hello_exit);
- ~
复制代码
编译就不行了
# gcc -c hello.c
hello.c: In function 'hello_init':
hello.c:7: error: 'KERN_ALERT' undeclared (first use in this function)
hello.c:7: error: (Each undeclared identifier is reported only once
hello.c:7: error: for each function it appears in.)
hello.c:7: error: syntax error before string constant
hello.c: In function 'hello_exit':
hello.c:13: error: 'KERN_ALERT' undeclared (first use in this function)
hello.c:13: error: syntax error before string constant
hello.c: At top level:
hello.c:17: warning: initialization from incompatible pointer type
是什么原因请各位赐教 |
|