错误:ISO C++ 不允许声明无类型的‘ContactsItem’ 错误:expected ‘;’ before ‘*’ token
来源:互联网 发布:hdfs如何保证数据可靠 编辑:程序博客网 时间:2024/06/06 17:02
刚刚遇到个问题,貌似不是第一次遇到了,在这里记录一下。
编译错误提示:
GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/usr/lib64/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include -I. -I. -I. -o ContactsItem.o ContactsItem.cpp
from ContactsItem.cpp:1:
GroupItem.h:50: 错误:ISO C++ 不允许声明无类型的‘ContactsItem’
GroupItem.h:50: 错误:expected ‘;’ before ‘*’ token
make: *** [ContactsItem.o] 错误 1
我这里的问题是我在ContactsItem类的头文件ContactsItem.h中包含了GroupItem.h,而GroupItem.h中又包含了ContactsItem.h头文件, 并声明有ContactsItem的对象。
所以在编译到ContactsItem.o时报ContactsItem类型没定义,因为GroupItem.h中声明有ContactsItem对象,而在ContactsItem.h包含GroupItem.h时还没有定义类ContactsItem。
所以编译到ContactsItem时就报错了。
0 0
- 错误:ISO C++ 不允许声明无类型的‘ContactsItem’ 错误:expected ‘;’ before ‘*’ token
- 错误: ISO C++ 不允许声明无类型的‘set_opt’ [-fpermissive]
- 错误:expected '}' before ';' token
- 错误:expected ‘)’ before ‘*’ token
- qt 中都使用第三方类 :错误:ISO C++ 不允许 声明无类型的‘CClient’
- linux下编译复数类型引发的错误:expected unqualified-id before '(' token
- 关于【error: expected identifier before ‘,’ token】错误的检查
- 错误:expected class-name before ‘{’ token
- expected identifier before ‘(’ token错误解决方式
- 关于“expected ';', ',' or ')' before '&' token”错误
- 编译错误:expected primary-expression before '(' token
- goto编译错误,error: expected ‘;’ before ‘:’ token
- 关于“expected ';', ',' or ')' before '&' token”错误
- 不允许声明无类型的***
- gcc 编译错误 error:expected class-name before ';' token
- expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token gcc编译错误
- NDK编译错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
- 提示错误“expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token“
- “net usershare”返回错误 255
- 发布一个文章读取模块,有前一篇和后一篇文章的功能,存储过程我直接贴上来了,大家自己改吧!
- JavaScript校验表单实例
- Github经典入门资料
- ASP.NET MVC3中Controller与View之间的数据传递总结
- 错误:ISO C++ 不允许声明无类型的‘ContactsItem’ 错误:expected ‘;’ before ‘*’ token
- smartform固定页行数
- hihoCoder - 1081 - 最短路径·一 (dijkstra算法!!)
- 【BZOJ】【P2946】【Poi2000】【公共串】【题解】【hash】
- ubuntu中apt-get安装与默认路径
- 只要开始,永远不晚
- 2015 CALLED THE INTERFACE OF 2014
- W: 无法下载 bzip2:/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_trusty_main_source_Sources
- 指定的SID在本机上已经存在解决方法