Problem defining a class in VC++ 2005

Started by
2 comments, last by MauMan 18 years, 7 months ago
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.
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.
---CyberbrineDreamsSuspected implementation of the Windows idle loop: void idle_loop() { *((char*)rand()) = 0; }
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
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!
---CyberbrineDreamsSuspected implementation of the Windows idle loop: void idle_loop() { *((char*)rand()) = 0; }

This topic is closed to new replies.

Advertisement