Jump to content
  • Advertisement
Sign in to follow this  
NovaCaine

Problem defining a class in VC++ 2005

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

I know this will sounds n00bish, but i'm pretty sure I've written it right but i get a build error of my constructor trying to return a value .\src\Game.cpp(13) : error C2533: 'CGame::{ctor}' : constructors not allowed a return type and heres the code: Header
class CGame {
	public:
		CGame( HWND p_hWnd, int p_iWidth, int p_iHeight );
		~CGame();

		// Renders the world
		void RenderScene();
		
	private:

		// Initalizes D3D
		bool InitializeDirect3D(HWND hwnd);

		// Shutsdown and cleans up D3D
		void ShutdownDirect3D();

CPP
CGame::CGame( HWND p_hWnd, int p_iWidth, int p_iHeight ) {
	m_D3DDevice = NULL;
	m_D3DObject = NULL;

	m_iHeight = p_iHeight;
	m_iWidth = p_iWidth;

	InitializeDirect3D( p_hWnd );
}

CGame::~CGame() {

}

if i comment out the constructor and destructor i get build errors in my other functions of not having the same return type as the header. Also im just compiling this class. Any thoughts? and thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Did you do something silly like forget the ; at the end of the class declaration?


class CGame {
public:
CGame( HWND p_hWnd, int p_iWidth, int p_iHeight );
~CGame();

// Renders the world
void RenderScene();

private:

// Initalizes D3D
bool InitializeDirect3D(HWND hwnd);

// Shutsdown and cleans up D3D
void ShutdownDirect3D();
};
^^^^^



That tends to get you odd errors like that.

Share this post


Link to post
Share on other sites
GRRRRRRRRRRRRRRRRR!!!!!!!!!!!!!!!!!!!!!

thats it!!! im sticking to one language only (for now)

been coding in Flash for the last month or to and got lazy. forgot about that.

Cheers all works now :D:D

Share this post


Link to post
Share on other sites
Not a prob!

I know what you mean; when moving between languages and/or environments it takes a bit to get your "sea legs" back!

Glad to help!

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!