免费注册 查看新帖 |

Chinaunix

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

关于/partitions.h:61: error: field `list' has incomplete type的解决!:) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-03-13 16:09 |只看该作者 |倒序浏览
本贴我说不好要放在哪个具体的讨论区,觉得c区还合适,就放这里了,
本贴的目的是帮比我还菜的小鸟遇到这个问题好解决些,写完这个我
想在google或者baidu上搜partitions.h:61: error: field `list' has incomplete type
这样的关键字,应该能找到这贴了吧.

我今天在编译linux2.6.14.2的内核的时候,遇到了这个问题,
但是在google和baidu上找,都是提问的,就没有理睬过,那好
我就自己找答案:
主要是针对s3c2410的内核移植,
在我都培植好后,开始make zImage,刚开始就遇到:

  1. In file included from arch/arm/mach-s3c2410/devs.c:20:
  2. include/linux/mtd/partitions.h:61: error: field `list' has incomplete type
  3. make[1]: *** [arch/arm/mach-s3c2410/devs.o] Error 1
  4. make: *** [arch/arm/mach-s3c2410] Error 2
复制代码

开始用partitions.h:61: error: field `list' has incomplete type狂搜
关键字,结果好几位都问,但是没答案,自己来,看到:

  1. include/linux/mtd/partitions.h:61: error: field `list' has incomplete type
复制代码

这,我想我们大家都能看明白,就是在说:partitions.h头文件中的61行有问题,
然后我们打开partitions.h文件,找到61行:

  1. 60 struct mtd_part_parser {
  2. 61         struct list_head list;
  3. 62         struct module *owner;
  4. 63         const char *name;
  5. 64         int (*parse_fn)(struct mtd_info *, struct mtd_partition **, unsigned long);
  6. 65 };
复制代码


一看list是个结构,而且错误中还提示了,list是一个不完整的类型,考虑struct list_head类型
是不是没有在文件中定义过,结果没有,查看partitions.h引用的头文件中有没有定义:

  1. grep struct list_head path/types.h
复制代码

也没有定义,开始怀疑,是不是没有引用适当的头文件呢?
开始cscope...
终于发现struct list_head这个结构的定义在linux/list.h下,如此找到了定义的地方,把
partitions.h文件的最前面加上#include <linux/list.h>
重新编译,成功!

论坛徽章:
0
2 [报告]
发表于 2008-04-18 19:23 |只看该作者
谢谢了!看样子还是不能浮躁,静下心来做事才行

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
3 [报告]
发表于 2008-04-18 19:36 |只看该作者
  1. grep struct list_head path/types.h
复制代码

这个命令是错误的吧?
应该是:
  1. grep "struct list_head" path/types.h
复制代码

才对。

难以想象 linux kernel 居然会有这样的问题。

论坛徽章:
0
4 [报告]
发表于 2015-11-19 16:25 |只看该作者
我也遇到同样的问题。
我编写另一个SPI设备的驱动模块,编译的时候提示错误“include/linux/spi/spi.h:66: error: field 'dev' has incomplete type”,
  1. struct spi_device {
  2.         struct device                dev;    //错误指向这里
  3.         struct spi_master        *master;
  4.         .......................
复制代码
搜索一下device的定义,位于文件 /include/linux/device.h 文件中,就把这个头文件添加到了spi.h文件开头。顺利通过编译。
我使用的Linux版本是2.6.22,查看了一下Linux3.0的内核文件,其中spi.h文件中包含有device.h。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP