c++ 头文件循环引用解法

A.h

#include "B.h"

class A{

public:

  B* m_b;

}

B.h

#include "A.h"

class B{

public:

  A* m_a;

}

上面这样是编译不过的,把A.h中的

#include "B.h"

去掉,改为

class B;

原文地址:https://www.cnblogs.com/wantnon/p/4978099.html