M
Maart_newbie
Hi all,
Can anyone tell me how I can include one header Form1.h into another
header Form2.h and the other way around without evolving into compile
errors? Both headers contain only one class in which I want to declare
an instance of the class in the other header file.
I assume that through some circulair reference this won't work, but I
don't know how otherwise to be able to declare the instances. The
compile error that I receive is:
1>Proj1.cpp
1>d:\Form2.h(26) : error C2143: syntax error : missing ';' before '^'
1>d:\Form2.h(26) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form2.h(26) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form2.h(35) : error C2065: 'f1' : undeclared identifier
1>d:\Form2.h(35) : error C2061: syntax error : identifier 'Form1'
1>Form2.cpp
1>d:\Form1.h(25) : error C2143: syntax error : missing ';' before '^'
1>d:\Form1.h(25) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form1.h(25) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form1.h(34) : error C2065: 'f2' : undeclared identifier
1>d:\Form1.h(34) : error C2061: syntax error : identifier 'Form2'
These file are part of a VS2006 project and both the classes in the
different files are part of the same namespace.
I was able to succesfully "cross include" the header Form1.h into the
source file belonging to Form2.h (Form2.cpp), but this doesn't give me
the ability to declare the class from Form1.h in Form2.h.
What is the right way to go here, this solution should be simple right?
Thanks in advance, Maart
Can anyone tell me how I can include one header Form1.h into another
header Form2.h and the other way around without evolving into compile
errors? Both headers contain only one class in which I want to declare
an instance of the class in the other header file.
I assume that through some circulair reference this won't work, but I
don't know how otherwise to be able to declare the instances. The
compile error that I receive is:
1>Proj1.cpp
1>d:\Form2.h(26) : error C2143: syntax error : missing ';' before '^'
1>d:\Form2.h(26) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form2.h(26) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form2.h(35) : error C2065: 'f1' : undeclared identifier
1>d:\Form2.h(35) : error C2061: syntax error : identifier 'Form1'
1>Form2.cpp
1>d:\Form1.h(25) : error C2143: syntax error : missing ';' before '^'
1>d:\Form1.h(25) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form1.h(25) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
1>d:\Form1.h(34) : error C2065: 'f2' : undeclared identifier
1>d:\Form1.h(34) : error C2061: syntax error : identifier 'Form2'
These file are part of a VS2006 project and both the classes in the
different files are part of the same namespace.
I was able to succesfully "cross include" the header Form1.h into the
source file belonging to Form2.h (Form2.cpp), but this doesn't give me
the ability to declare the class from Form1.h in Form2.h.
What is the right way to go here, this solution should be simple right?
Thanks in advance, Maart