include ?

Started by
0 comments, last by Anonymous Poster 24 years ago
I have a problem. Here is the code: example.cpp: #include "blabla.h" // here is the definition of ExampleClass ExampleClass * SomePointer #include "inc.h" inc.h: class HeHe { void thess() { SomePointer->Blah->Blah2(); } }; I have following problem : HeHe.thess() cant acces the pointer "Somepointer" which is defined in "example.cpp". If i try to give the pointer over an argument of thess(), it causes the error that ExampleClass is not defined. ExampleClass is defined in "blabla.h" include file.I thaught that the compiler binds all include files together to one big file and then compiles !? Who can help me ? thanx, Anonymous Poster
i am the 2 between 0 and 1
Advertisement
There are two mistakes:

You have to include blabla.h in inc.h because else ExampleClass isn''t known in inc.h. Then you don''t need to include blabla.h in example.cpp.
And you must write
extern ExampleClass *SomePointer;
into thess() because this variable is in an other source file.

Visit our homepage: www.rarebyte.de.st

GA
Visit our homepage: www.rarebyte.de.stGA

This topic is closed to new replies.

Advertisement