Jump to content
  • Advertisement
Sign in to follow this  
monkey4sale

Errors, cant find why

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

While using working through some tutorials I managed to develop a compiler error which I cant resolve. C2533, A constructor cannot have a return type (not even a void return type). but I dont specify a return type
/* CPlayer complement header */
#include "Player.h"
#include <windows.h>

/* Does Nothing */
CPlayer::CPlayer() //Error here
{
}
/* Does nothing */
CPlayer::~CPlayer()
{
}
Player.h contains the class information, while the methods and such are in a source file, I dont understand why the book is doing it this way, but im rolling with it. I also get an error when I try to use an enumerator.
/* Windows standard header file */
#include <windows.h>
/* Standard input/output header file */
#include <stdio.h>

/* ConLib header file */
#include "ConLib.h"
/* CPlayer header file */
#include "Player.h"

/* Game status enumerator */
enum GameStatus //error here
{
	GameMainMenu		= 1,
	GameRunning			= 2,
	GamePaused			= 3,
	GameWon				= 4,
	GameLostLife		= 5,
	GameLost			= 6,
	GameExit			= 7,
	GameSplashScreen	= 8
};

/* game difficulty enumerator */
enum GameDifficulty
{
	GameEasy		=1,
	GameMedium		=2,
	GameDifficult	=3
};
"unexpected 'enum' 'GameStatus'. Did you forget a ';'?" any reason for this one?

Share this post


Link to post
Share on other sites
Advertisement
As the error says 'did you forget a semicolon?'. You need to place a semicolon after the closing } for a class declaration. It's an easy one to miss, and since both files include Player.h it could be causing both errors. Have a look in Player.h.

Share this post


Link to post
Share on other sites
there is something wrong with Player.h...
you probably forgot to add ; on the CPlayer class

Share this post


Link to post
Share on other sites
lol, gratz, hate those small things.

1 semicolon between 6 files, results in 12 errors.... depressing


now the book splits up the classes into source files and header files, wouldnt it be easier to have one header file instead of two different files?

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.

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!