[C++]出错member access into incomplete type
文章转自:https://blog.csdn.net/wcjwdq/article/details/43604679
版权归原作者。
在c++中,有四个文件demoA.h, demoA.cpp, demoB.h, demoB.cpp。
在demoA.h中有一个类为class demoA, 在demoB.h中有一个类为class demoB。
如果demoA类要用到demoB类,并且demoB类也要用到demoA类,那么必须要如下:
1、在demoA类的cpp文件中包含demoB类的头文件路径;
2、在demoB类的h文件中加Class demoA,同时也要在demoB类的cpp文件中添加demoA类的头文件路径;
如下:
// demoA.h
class demoA
{demoB * b;
};// demoA.cpp
#include "demoB.h"// demoB.h
class demoA;
class demoB
{demoA * parent;
};// demoB.cpp
#include "demoA.h"
这样就好了。
如果在demoB.cpp中没有加入demoA.h,那么会报错:member access into incomplete type
[C++]出错member access into incomplete type相关推荐
- Qt之解决error: member access into incomplete type ‘UI::XXX‘
解决方案:重新编译后关闭当前项目文件,重新打开项目即可消除该错误提示
- 2020-10-26runtime error: member access within null pointer of type ‘struct ListNode‘ (solution.cpp)错
runtime error: member access within null pointer of type 'struct ListNode' (solution.cpp)错误 /*** Def ...
- leetcode报错:member access within null pointer of type struct ListNode
leetcode报错:member access within null pointer of type 'struct ListNode'
- 【Leetcode记录】runtime error: member access within null pointer of type ‘ListNode‘ (solution.cpp) SUMMA
环形链表快慢指针: runtime error: member access within null pointer of type 'ListNode' (solution.cpp) SUMMARY ...
- runtime error: member access within null pointer of type ‘MyLinkedList::ListNode‘ (solution.cpp)
ERROR情况: Line 40: Char 12: runtime error: member access within null pointer of type 'MyLinkedList::L ...
- runtime error: member access within null pointer of type ‘struct ListNode‘错误
LeetCode203错误分析: (3条消息) LeetCode:runtime error: member access within null pointer of type 'struct Li ...
- runtime error: member access within null pointer of type ‘struct ListNode‘
错误题目:删除排序链表中的重复元素 例如 1->1->2 输出 1->2 错误原因:试图使用空指针 解决方法:增加判断条件,并且判断的顺序不能改变.排除对空指针的引用. /*** D ...
- QT编译错误:invalid application of 'sizeof' to incomplete type 'Qt3DRender::QPickEvent'
执行3D常将中实体的pick操作,结果出现了编译错误:invalid application of 'sizeof' to incomplete type 'Qt3DRender::QPickEven ...
- 关于编译报错“dereferencing pointer to incomplete type...
FORM:https://my.oschina.net/michaelyuanyuan/blog/68203 今天同事问了我一个问题,他make的时候报错,"第201行:dereferenc ...
最新文章
- Tomcat6.0.13下配置Tomcat Administration Web Application
- python中Scipy模块求取积分
- 进程——Windows核心编程学习手札系列之四
- android 配置ADB环境
- selenium和python的关系,Selenium+python
- 玩人工智能的你必须知道的语音识别技术原理
- linux 镜像 多 网络,Linux内核实现多路镜像流量聚合和复制的方法
- 华南主板超频设置图解_支持XMP2.0,3000稳超3733MHz,威刚龙耀D60G超频体验
- python 找色点击_[原创]python实现触动精灵引擎找色找字函数,为机器学习添加手脚...
- 单龙芯3A3000-7A1000PMON研究学习-(25)撸起袖子干-再来一杯代码7
- web请求报出 “超过了最大请求长度”
- python作业代做_CSC1001作业代做、代写Programming Methodology作业、代做Python实验作业、Python程序设计作业调试...
- 只利用 phpstudy 如何运行PHP文件 超详细教程
- 软件工程师考试报名须知
- 沉痛悼念游戏开发技术专家毛星云(网名“浅墨”)
- 【Linux】Linux的内核空间(低端内存、高端内存)
- 数据分析师常用的 Linux 命令总结
- 加密算法的重要性以及了解加密算法分类
- 打造政产学研新型研发机构 加速人工智能科研成果转化...
- 一篇JavaScript技术栈带你了解继承和原型链