驱动编译问题,请教,谢谢

levenshiry   2007-12-25 15:24 楼主
大家好:
我现在写了一个在简单不过的驱动
#ifndef MODULE
        #define MODULE
#endif

#include
#include

#include

#include
#include

#include

//#include
//#include
static int init_module(void)
{
        printk("<1>Hello,world!\n");
        return 0;
}
static void cleanup_module(void)
{
        printk("<1>Goodbye\n");
}
#ifndef MODULE
        #define MODULE
#endif

#include
#include

#include

#include
#include

#include

//#include
//#include
static int init_module(void)
{
        printk("<1>Hello,world!\n");
        return 0;
}
static void cleanup_module(void)
{
        printk("<1>Goodbye\n");
}
#ifndef MODULE
        #define MODULE
#endif

#include
#include

#include

#include
#include

#include

//#include
//#include
static int init_module(void)
{
        printk("<1>Hello,world!\n");
        return 0;
}
static void cleanup_module(void)
{
        printk("<1>Goodbye\n");
}
#ifndef MODULE
        #define MODULE
#endif

#include
#include

#include

#include
#include
#include
#include
#include

static int init_module(void)
{
        printk("<1>Hello,world!\n");
        return 0;
}
static void cleanup_module(void)
{
        printk("<1>Goodbye\n");
}
module_init(init_module);
module_exit(cleanup_module);
但是发现我不能引用linux/fs.h
报错信息如下:
[root@localhost ARM2CPLD]# make
arm-linux-gcc -c -O2 -Wall  -DMODULE -I/ARMs3c2410/kernel/include ARM2CPLD.c
In file included from ARM2CPLD.c:15:
/ARMs3c2410/kernel/include/linux/malloc.h:4:2: warning: #warning linux/malloc.h is deprecated, use linux/slab.h instead.
In file included from /ARMs3c2410/kernel/include/linux/fs.h:13,
                 from ARM2CPLD.c:16:
/ARMs3c2410/kernel/include/linux/types.h:14: error: parse error before "dev_t"
/ARMs3c2410/kernel/include/linux/types.h:14: warning: type defaults to `int' in declaration of `dev_t'
/ARMs3c2410/kernel/include/linux/types.h:14: warning: data definition has no type or storage class
ARM2CPLD.c: In function `init_module':
ARM2CPLD.c:22: warning: implicit declaration of function `printk'
ARM2CPLD.c: At top level:
ARM2CPLD.c:29: warning: type defaults to `int' in declaration of `module_init'
ARM2CPLD.c:29: warning: parameter names (without types) in function declaration
ARM2CPLD.c:29: warning: data definition has no type or storage class
ARM2CPLD.c:30: warning: type defaults to `int' in declaration of `module_exit'
ARM2CPLD.c:30: warning: parameter names (without types) in function declaration
ARM2CPLD.c:30: warning: data definition has no type or storage class
ARM2CPLD.c:21: warning: 'init_module' defined but not used
ARM2CPLD.c:26: warning: 'cleanup_module' defined but not used
我看了一下,好像主要的错误就是那个
/ARMs3c2410/kernel/include/linux/types.h:14: error: parse error before "dev_t"
请问我这个东西是怎么一回事啊,谢谢

回复评论 (2)

关注 接分
点赞  2008-5-1 08:20
在吗》我看了你的问题了。我觉得程序部分没有错误的。。。
你QQ多少啊、、加我304647016
点赞  2008-7-24 20:37
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复