Chinaunix

标题: linux2.6的设备驱动程序编译头文件出错 [打印本页]

作者: ld506624210    时间: 2011-03-29 20:51
标题: linux2.6的设备驱动程序编译头文件出错
我的驱动程序:
//hello.c
#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 "Goodbye, cruel world\n");
}

module_init(hello_init);
module_exit(hello_exit);

我放在了/test/testDev/Hello目录下。

这是我的编译命令:
gcc  -I /lib/modules/2.6.21-1.3194.fc7/build/include -o hello.o hello.c

编译不能通过,会显示很多头文件错误,这是为什么,怎么解决。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2