文章转自: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相关推荐

  1. Qt之解决error: member access into incomplete type ‘UI::XXX‘

    解决方案:重新编译后关闭当前项目文件,重新打开项目即可消除该错误提示

  2. 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 ...

  3. leetcode报错:member access within null pointer of type struct ListNode

    leetcode报错:member access within null pointer of type 'struct ListNode'

  4. 【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 ...

  5. 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 ...

  6. 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 ...

  7. runtime error: member access within null pointer of type ‘struct ListNode‘

    错误题目:删除排序链表中的重复元素 例如 1->1->2 输出 1->2 错误原因:试图使用空指针 解决方法:增加判断条件,并且判断的顺序不能改变.排除对空指针的引用. /*** D ...

  8. QT编译错误:invalid application of 'sizeof' to incomplete type 'Qt3DRender::QPickEvent'

    执行3D常将中实体的pick操作,结果出现了编译错误:invalid application of 'sizeof' to incomplete type 'Qt3DRender::QPickEven ...

  9. 关于编译报错“dereferencing pointer to incomplete type...

    FORM:https://my.oschina.net/michaelyuanyuan/blog/68203 今天同事问了我一个问题,他make的时候报错,"第201行:dereferenc ...

最新文章

  1. Tomcat6.0.13下配置Tomcat Administration Web Application
  2. python中Scipy模块求取积分
  3. 进程——Windows核心编程学习手札系列之四
  4. android 配置ADB环境
  5. selenium和python的关系,Selenium+python
  6. 玩人工智能的你必须知道的语音识别技术原理
  7. linux 镜像 多 网络,Linux内核实现多路镜像流量聚合和复制的方法
  8. 华南主板超频设置图解_支持XMP2.0,3000稳超3733MHz,威刚龙耀D60G超频体验
  9. python 找色点击_[原创]python实现触动精灵引擎找色找字函数,为机器学习添加手脚...
  10. 单龙芯3A3000-7A1000PMON研究学习-(25)撸起袖子干-再来一杯代码7
  11. web请求报出 “超过了最大请求长度”
  12. python作业代做_CSC1001作业代做、代写Programming Methodology作业、代做Python实验作业、Python程序设计作业调试...
  13. 只利用 phpstudy 如何运行PHP文件 超详细教程
  14. 软件工程师考试报名须知
  15. 沉痛悼念游戏开发技术专家毛星云(网名“浅墨”)
  16. 【Linux】Linux的内核空间(低端内存、高端内存)
  17. 数据分析师常用的 Linux 命令总结
  18. 加密算法的重要性以及了解加密算法分类
  19. 打造政产学研新型研发机构 加速人工智能科研成果转化...
  20. 一篇JavaScript技术栈带你了解继承和原型链

热门文章

  1. 第一部分 OpenStack及其构成简介
  2. JQueryEasyUI datagrid框架的基本使用
  3. 运行HelloJersey遇到异常解决方法
  4. maven本地安装jar
  5. 互联网企业招聘零分考生 扇了谁的耳光?
  6. Leetcode 210.课程表II
  7. 资源图与死锁定理的灵活运用
  8. pytorch中创建多个空的tensor、pycharm从自己写的.py中引用函数下面画红线等问题
  9. pytorch convLSTM实现
  10. 离线人脸识别C#类库分享 虹软2.0版本