Advertisement Jump to content
Sign in to follow this  
Penanito

Cant create class object?

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

So i have a class:

class Sprite
{...};

and im trying to make an object of that class called mrSquare in another class:

private:

	Sprite *mrSquare;

but i get an error, "syntax error : missing ';' before identifier 'mrSquare", as if its not recognizing 'Sprite' as a class type? I typed this code from some other tutorials im doing for practice and everything seems to be okay, including the header file and everything where im attempting to create the class...is there something im doing wrong?

Share this post


Link to post
Share on other sites
Advertisement

Since the compiler is accusing a syntax error, it would be better if you could show us more code. The declaration of the second class would probably be enough, but the full code of the file would be better. (pastebin it if too big.)

 

Also, make sure to include your "header including section" for both files (as they are probably declared in two different files). This way we can see if we have a circular dependency or similar problem (that would result in weird syntax error reports).

Edited by dejaime

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!