免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1444 | 回复: 3
打印 上一主题 下一主题

求教:关于头文件的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-06-23 15:09 |只看该作者 |倒序浏览
小弟写一个程序,需要用到一个头文件中的结构体,在开头已经把这个头文件包含了,结果make的时候还是提示说找不到这个结构体,这是什么原因呢?请大家指教!
(Linux内核2.6.32.1)

头文件包含如下:
  1. #include <linux/module.h>
  2. #include <linux/init.h>
  3. #include <linux/sched.h>
  4. #include <linux/kernel.h>
  5. #include <linux/fs.h>
  6. #include <linux/types.h>
  7. #include <linux/buffer_head.h>
  8. #include <linux/blkdev.h>
  9. #include <linux/msdos_fs.h>
  10. #include <linux/elevator.h>
  11. #include <linux/fcntl.h>
  12. #include <linux/delay.h>
复制代码
那个结构体叫做elevator_queue,在elevator.h文件中;

然后编译结果如下:
  1. root@ubuntu:/home/zhenghailong/codes/Blk_Test# make
  2. make -C /lib/modules/2.6.32.1/build M=/home/zhenghailong/codes/Blk_Test modules
  3. make[1]: Entering directory `/usr/src/linux-2.6.32.1'
  4.   CC [M]  /home/zhenghailong/codes/Blk_Test/blk.o
  5. /home/zhenghailong/codes/Blk_Test/blk.c: In function ‘simp_blkdev_init’:
  6. /home/zhenghailong/codes/Blk_Test/blk.c:68: error: ‘elevator_queue’ undeclared (first use in this function)
  7. /home/zhenghailong/codes/Blk_Test/blk.c:68: error: (Each undeclared identifier is reported only once
  8. /home/zhenghailong/codes/Blk_Test/blk.c:68: error: for each function it appears in.)
  9. /home/zhenghailong/codes/Blk_Test/blk.c:68: error: ‘old_e’ undeclared (first use in this function)
  10. make[2]: *** [/home/zhenghailong/codes/Blk_Test/blk.o] Error 1
  11. make[1]: *** [_module_/home/zhenghailong/codes/Blk_Test] Error 2
  12. make[1]: Leaving directory `/usr/src/linux-2.6.32.1'
  13. make: *** [defaul
复制代码

论坛徽章:
0
2 [报告]
发表于 2010-06-23 15:32 |只看该作者
不好意思,问题解决了,声明变量前忘了struct。。。

论坛徽章:
0
3 [报告]
发表于 2010-06-28 18:02 |只看该作者

论坛徽章:
0
4 [报告]
发表于 2010-06-28 21:16 |只看该作者
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP