gcc编译简单内核出错!!!
发表于 : 2007-11-22 17:04
下面是一个很简单的hello内核模块程序 我已经用sudo apt-get install build-essential安装gcc了
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
int HELLO(void){printk("hello!\n");return 1;}
void BYE(void){printk("bye!\n");}
module_init(HELLO);
module_exit(BYE);
用gcc执行
root@jhx-ubuntu:~/c# gcc -c hello.c
hello.c:1:26: 错误: linux/init.h:No such file or directory
hello.c:2:26: 错误: linux/module.h:No such file or directory
是不是gcc默认的头文件路径有问题呢?该如何解决呢?
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
int HELLO(void){printk("hello!\n");return 1;}
void BYE(void){printk("bye!\n");}
module_init(HELLO);
module_exit(BYE);
用gcc执行
root@jhx-ubuntu:~/c# gcc -c hello.c
hello.c:1:26: 错误: linux/init.h:No such file or directory
hello.c:2:26: 错误: linux/module.h:No such file or directory
是不是gcc默认的头文件路径有问题呢?该如何解决呢?