A
Andre
Is it possible to declare interdependent classes in different header
files?
If so, how could the following errors in the following piece of code
be corrected?
Thanks in advance,
Andre
1>c:\users\andre\_my\tmp\test01\test01\Struct_B.h(10): error C2146:
syntax error : missing ';' before identifier 'mStructA'
1>c:\users\andre\_my\tmp\test01\test01\Struct_B.h(10): error C4430:
missing type specifier - int assumed. Note: C++ does not support
default-int
1>c:\users\andre\_my\tmp\test01\test01\Struct_B.h(10): error C4430:
missing type specifier - int assumed. Note: C++ does not support
default-int
1>c:\users\andre\_my\tmp\test01\test01\Struct_A.h(8): error C2236:
unexpected 'class' 'Struct_A'. Did you forget a ';'?
1>c:\users\andre\_my\tmp\test01\test01\Struct_A.h(8): error C2143:
syntax error : missing ';' before '{'
1>c:\users\andre\_my\tmp\test01\test01\Struct_A.h(8): error C2447:
'{' : missing function header (old-style formal list?)
In Struct_A.hpp:
#ifndef STRUCT_A
#define STRUCT_A
#include "Struct_B.h"
class Struct_A
{
public:
Struct_B mStructB;
}
#endif // STRUCT_A
In Struct_B.hpp:
#ifndef STRUCT_B
#define STRUCT_B
#include "Struct_A.h"
class Struct_B
{
public:
Struct_A mStructA;
}
#endif // STRUCT_B
files?
If so, how could the following errors in the following piece of code
be corrected?
Thanks in advance,
Andre
1>c:\users\andre\_my\tmp\test01\test01\Struct_B.h(10): error C2146:
syntax error : missing ';' before identifier 'mStructA'
1>c:\users\andre\_my\tmp\test01\test01\Struct_B.h(10): error C4430:
missing type specifier - int assumed. Note: C++ does not support
default-int
1>c:\users\andre\_my\tmp\test01\test01\Struct_B.h(10): error C4430:
missing type specifier - int assumed. Note: C++ does not support
default-int
1>c:\users\andre\_my\tmp\test01\test01\Struct_A.h(8): error C2236:
unexpected 'class' 'Struct_A'. Did you forget a ';'?
1>c:\users\andre\_my\tmp\test01\test01\Struct_A.h(8): error C2143:
syntax error : missing ';' before '{'
1>c:\users\andre\_my\tmp\test01\test01\Struct_A.h(8): error C2447:
'{' : missing function header (old-style formal list?)
In Struct_A.hpp:
#ifndef STRUCT_A
#define STRUCT_A
#include "Struct_B.h"
class Struct_A
{
public:
Struct_B mStructB;
}
#endif // STRUCT_A
In Struct_B.hpp:
#ifndef STRUCT_B
#define STRUCT_B
#include "Struct_A.h"
class Struct_B
{
public:
Struct_A mStructA;
}
#endif // STRUCT_B