Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualSerapth

Posted 01 March 2013 - 09:48 AM

CHealthBar HealthBar;

 

That is your problem.

 

 

When using a forward declaration, you can only use a POINTER to the object, you cant actually declare an instance, as the compiler has no idea of the actual composition and size of a forward declared class.

 

Change CHealthBar to a reference or pointer, and your code should work.

 

 

EDIT: This StackOverflow answer explains it in a bit more detail.  So either change it so CEntity is aware of CHealthBar, or if you are going to continue using a forward declaration, make CHealthBar in CEntity a pointer or reference.


#1Serapth

Posted 01 March 2013 - 09:46 AM

CHealthBar HealthBar;

 

That is your problem.

 

 

When using a forward declaration, you can only use a POINTER to the object, you cant actually declare an instance, as the compiler has no idea of the actual composition and size of a forward declared class.

 

Change CHealthBar to a reference or pointer, and your code should work


PARTNERS