Problem with constructor

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
corvo
Posts: 2
Joined: October 28th, 2012, 6:24 pm

Problem with constructor

Post by corvo » October 28th, 2012, 6:32 pm

I got this problem now when I`m on lesson 8 from the beginner tutorials. So I do everything correctly and on the last step( Draw the game over thing) when I try to build the solution I get this error:
1>..\Assets\Game.cpp(24): error C2533: 'Game::{ctor}' : constructors not allowed a return type
Here are my lines 23, 24 and 25:
Game::Game( HWND hWnd,const KeyboardServer& kServer )
: gfx ( hWnd ),
kbd( kServer ),
Anyone has an idea where is the bug ?

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Problem with constructor

Post by cameron » October 28th, 2012, 8:17 pm

There is not enough code there to say anything post your whole game .cpp and game .h or just post your soultion.
Computer too slow? Consider running a VM on your toaster.

User avatar
npissoawsome
Posts: 114
Joined: June 8th, 2012, 3:01 pm

Re: Problem with constructor

Post by npissoawsome » October 28th, 2012, 9:33 pm

corvo wrote:I got this problem now when I`m on lesson 8 from the beginner tutorials. So I do everything correctly and on the last step( Draw the game over thing) when I try to build the solution I get this error:
1>..\Assets\Game.cpp(24): error C2533: 'Game::{ctor}' : constructors not allowed a return type
Here are my lines 23, 24 and 25:
Game::Game( HWND hWnd,const KeyboardServer& kServer )
: gfx ( hWnd ),
kbd( kServer ),
Anyone has an idea where is the bug ?
get rid of the comma after kbd( kServer )

corvo
Posts: 2
Joined: October 28th, 2012, 6:24 pm

Re: Problem with constructor

Post by corvo » October 29th, 2012, 6:45 am

Here is the code and thank you for your attention but the bug is not in the comma.
Attachments
zippedcode.rar
(38.62 KiB) Downloaded 146 times

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Problem with constructor

Post by chili » October 31st, 2012, 2:58 pm

Go to Game.h and put a semicolon at the very end of the class definition. Never ever forget or delete those because they create build errors that are hard to diagnose.
Chili

Post Reply