• Advertisement

Archived

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

unexpected 'class Player (' ???

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

here is my code " class GUI : public VisibleThing { public: GUI(LPDIRECTDRAWSURFACE4 Buffer, HWND MainWindow, HINSTANCE hInstance); " and here the errors I get. error C2629: unexpected ''class Player ('' error C2238: unexpected token(s) preceding '';'' Finally I would like to know what is the problem and how tofix these errors, I have sometimes managed to do that but I don''t know how. I have Included windows.h Help would be highly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
If you derive class B from class A, then don''t you have to base the constructor of class B on the constructor of class A also, like so:
...
class GUI : public VisibleThing
{
___public:
________ GUI(.....) : VisibleThing(....) {}
...

??
Just a thought (I''m only just a newbie myself).

Share this post


Link to post
Share on other sites
Did you, perhaps, forget a ";" after one of your class declarations (as in, after the very last "}")? That''s usually the cause of that particular error. Note that you need to check all your headers for this, as usually it''s the file the compiler attempted to determine previous to this one that caused the error (in other words, the file it complained about might not be the file with the error in it).

Red Ant: indentation doesn''t matter, compilers usually don''t care. You''re right on the constructor, but... only if you implement the constructor inline, in your header, as your snippet showed. Otherwise, you would do that in your .cpp file during implementation, as the snippet by Jonppe does (I''m assuming he does it correctly in the .cpp).

-fel

Share this post


Link to post
Share on other sites
Ï checked all headers for mistakes but the error was actually
in the same file. I had
#indef GUI
#define GUI

and I have never really thought about it that I had class of the same name. Like in the other thread that had question of redefining return, I it may have some not wanted effects.

Share this post


Link to post
Share on other sites

  • Advertisement