- 论坛徽章:
- 0
|
小弟写一个程序,需要用到一个头文件中的结构体,在开头已经把这个头文件包含了,结果make的时候还是提示说找不到这个结构体,这是什么原因呢?请大家指教!
(Linux内核2.6.32.1)
头文件包含如下:- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/sched.h>
- #include <linux/kernel.h>
- #include <linux/fs.h>
- #include <linux/types.h>
- #include <linux/buffer_head.h>
- #include <linux/blkdev.h>
- #include <linux/msdos_fs.h>
- #include <linux/elevator.h>
- #include <linux/fcntl.h>
- #include <linux/delay.h>
复制代码 那个结构体叫做elevator_queue,在elevator.h文件中;
然后编译结果如下:- root@ubuntu:/home/zhenghailong/codes/Blk_Test# make
- make -C /lib/modules/2.6.32.1/build M=/home/zhenghailong/codes/Blk_Test modules
- make[1]: Entering directory `/usr/src/linux-2.6.32.1'
- CC [M] /home/zhenghailong/codes/Blk_Test/blk.o
- /home/zhenghailong/codes/Blk_Test/blk.c: In function ‘simp_blkdev_init’:
- /home/zhenghailong/codes/Blk_Test/blk.c:68: error: ‘elevator_queue’ undeclared (first use in this function)
- /home/zhenghailong/codes/Blk_Test/blk.c:68: error: (Each undeclared identifier is reported only once
- /home/zhenghailong/codes/Blk_Test/blk.c:68: error: for each function it appears in.)
- /home/zhenghailong/codes/Blk_Test/blk.c:68: error: ‘old_e’ undeclared (first use in this function)
- make[2]: *** [/home/zhenghailong/codes/Blk_Test/blk.o] Error 1
- make[1]: *** [_module_/home/zhenghailong/codes/Blk_Test] Error 2
- make[1]: Leaving directory `/usr/src/linux-2.6.32.1'
- make: *** [defaul
复制代码 |
|