将A与B两个类分别写到A.h和B.h中,编译时出现Error: Incomplete Type Class 错误
IDE:Code::Blocks
编译器:GCC
将A与B两个类分别写到A.h和B.h中
A.h的内容如下:
#include “B.h”
Class B;//前向声明
Class A
{
void use(B *b)
}
B.h的内容如下:
#include “A.h”
Class A;//前向声明
Class B
{
void use(A *a)
}
编译会出现Error: Incomplete Type Class错误,
解决办法:将A与B写到同一个头文件中
Error: Incomplete Type Class
最新推荐文章于 2024-11-21 22:26:21 发布