嵌套定义结构体
我在使用嵌套的结构体前,先声明了该结构体,但是却还是出现了“error C2079: 'BB::aa' uses undefined struct 'AA'”的错误,请问是怎么回事?如何解决这个问题,谢谢!
#include "stdafx.h"
struct AA;
struct BB;
struct BB
{
int i;
AA aa;
};
struct AA
{
double j;
BB bb;
};
int _tmain(int argc, _TCHAR* argv[])
{
AA a;
a.j = 0.5;
BB b;
b.i = 109;
return 0;
}