gcc编译出现field 'xxx' has incomplete type的问题
2013-01-12 21:34
656 查看
一般情况下,是由于向前引用或递归引用自身造成的,网上已经有很多讨论了,比如:
http://bbs.csdn.net/topics/200003470 http://bbs.csdn.net/topics/30097292 http://blog.csdn.net/xlfb8057/article/details/2814768
但是,最近写程序时又出现了该问题,使用前向引用声明也无法解决问题. 为什么还是出错呢?
后来发现竟然是由于编译时多加了一个 -pthread 参数, 去掉就好了, 不明白为什么会出现这种现象.
另外,还可以尝试使用struct的别名来定义成员。
http://bbs.csdn.net/topics/200003470 http://bbs.csdn.net/topics/30097292 http://blog.csdn.net/xlfb8057/article/details/2814768
但是,最近写程序时又出现了该问题,使用前向引用声明也无法解决问题. 为什么还是出错呢?
后来发现竟然是由于编译时多加了一个 -pthread 参数, 去掉就好了, 不明白为什么会出现这种现象.
另外,还可以尝试使用struct的别名来定义成员。
相关文章推荐
- 程序编译是出现"field has incomplete type"问题的解决
- 两个C++编译异常及解决方法-does not name a type和field `XX' has incomplete type
- Qt程序编译是出现"field has incomplete type"问题的解决(转)
- 前向定义导致 程序编译出现"field has incomplete type"问题的解决
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- 程序编译是出现"field has incomplete type"问题的解决
- 程序编译是出现"field has incomplete type"问题的解决
- 关于GCC编译C语言多文件出现类似dereferencing pointer to incomplete type ‘struct TreeNode’的问题
- arm环境下编译出现下面警告的解决办法 note: the mangling of 'va_list' has changed in GCC 4.4
- 编译busybox的时候出现error: field 'in' has incomplete type
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- 编译busybox的时候出现error: field 'in' has incomplete type
- variable `xxx' has initializer but incomplete type
- variable `xxx' has initializer but incomplete type
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- 编译错误 --- does not name a type和field `XX' has incomplete type
- (转载)symbian编译问题MR编译通过,FP2编译失败出现问题 APP' has initialised data
- 用gcc编译.cpp文件可能出现"undefined reference to `__gxx_personality_v0'"问题的解决