error C2079: 'A::b' uses undefined class 'B'

I really want to know what the compiler is doing here.

I have 3 files:
==================== A.h ===================
#ifndef A_H
#define A_H

#include "B.h"

class B;

class A
{
B b;
};

#endif

==================== B.h ===================
#ifndef B_H
#define B_H

#include "A.h"

class A;

class B
{
A** a;
};

#endif

================== B.cpp ===================
#include "B.h"

================= main.cpp =================
#include "A.h"
#include "B.h"

int main( int argc, char* argv[])
{
return 1;
}

-----------------------------------------------------------------
when I hit start Debugging, I get the following error:
error C2079: 'A::b' uses undefined class 'B'

The weird part is though that if I comment out the line in B.cpp, it compiles with no problems.... does anyone know why this is??????

Thanks a lot


Last edited on
Topic archived. No new replies allowed.