Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Anonymous Poster

include ?

This topic is 6789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites
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


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!