• Advertisement
Sign in to follow this  

OK, this is stupid...

This topic is 4917 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

Hello. I have a stupid problem I hope someone can help with. I have a CApp class. Contained in that are all my game management objects (such as the input reader, scene graph, etc.) along with game objects (like my global camera, and the key bindings table). Needless to say, other game objects, like CPlayer, need to be able to access this CApp object (to get input, query about game objects, etc), and it needs to know about them (to create them). I put a global forward declaration to my CApp class, but I get the compiler error "use of undefined type 'CApp'" whenever I try to use access any CApp function from a game object. I know there's a solution, but I've got some kind of mental block, and I can't think. Any ideas how I can resolve this problem? If I haven't made myself clear, ask for more specifics...

Share this post


Link to post
Share on other sites
Advertisement
in CApp.h:

class CPlayer;

class CApp { ... }

in CPlayer.h:

class CApp;

class CPlayer { ... }

in CApp.cpp & CPlayer.cpp:

#include "CApp.h"
#include "CPlayer.h"

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement