need help: Lesson 8

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Cletus
Posts: 18
Joined: December 7th, 2012, 6:56 pm

need help: Lesson 8

Post by Cletus » December 7th, 2012, 7:26 pm

Hello, I am just starting on these tutorials, and i would like to say first...they're awesome =]

I love that you teach people a skill which can drastically change thier lives, not only in a simple, easy to understand, and entertaining way, but you also do it all for free. and considering i barely have any money to my name....that is awesome lol

anyway...to get past the buttering up phase of my post...im having a problem on lesson 8. I've done all the steps up until the test with the face guy. Ive removed the other cursor, ive removed its moving code, and ive replaced the remaining cursor with the face code. I've also declared the faceX, faceY, and poo variables in the game.h and i've even went a step ahead of where i was and declared values for faceX and faceY to see if this would help the errors.

anyway, when i build my program i get these errors:

1> Windows.cpp
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(26): error C2146: syntax error : missing ';' before identifier 'kServ'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(26): error C2512: 'Game' : no appropriate default constructor available
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(39): error C2228: left of '.OnUpPressed' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(42): error C2228: left of '.OnDownPressed' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(45): error C2228: left of '.OnLeftPressed' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(48): error C2228: left of '.OnRightPressed' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(51): error C2228: left of '.OnSpacePressed' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(54): error C2228: left of '.OnEnterPressed' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(62): error C2228: left of '.OnUpReleased' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(65): error C2228: left of '.OnDownReleased' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(68): error C2228: left of '.OnLeftReleased' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(71): error C2228: left of '.OnRightReleased' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(74): error C2228: left of '.OnSpaceReleased' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(77): error C2228: left of '.OnEnterReleased' must have class/struct/union
1> type is 'int'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\windows.cpp(108): error C2664: 'Game::Game(HWND,const KeyboardServer &)' : cannot convert parameter 2 from 'int' to 'const KeyboardServer &'
1> Reason: cannot convert from 'int' to 'const KeyboardServer'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1> Game.cpp
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(23): error C2761: '{ctor}' : member function redeclaration not allowed
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(24): error C2059: syntax error : ':'
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(24): error C2065: 'hWnd' : undeclared identifier
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(25): error C2065: 'kServer' : undeclared identifier
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\me\documents\game makin crap\chili directx framework\assets\game.cpp(28): error C2448: 'faceY' : function-style initializer appears to be a function definition

I have a feeling that this is all attributing to maybe 1 or 2 errors in syntax or something, but ive been looking at it for a good while now and my logic has proven ineffective. Therefore i am humbly asking for a bit of help. I have included the zip file so you can see what i did for yourself.

Any help is greatly appreciated
Attachments
Chili DirectX Framework.zip
my project thus far
(8.24 MiB) Downloaded 133 times
Image
Consistency is the hobgoblin of the small mind ~Terrance McKenna~

User avatar
codinitup
Posts: 112
Joined: June 27th, 2012, 7:43 am

Re: need help: Lesson 8

Post by codinitup » December 8th, 2012, 2:30 am

It kinda irritates me when people don't read their errors, for example the ones that say "missing type specifier - int assumed" that means that you just started using a variable without telling the compiler the type. Just read the errors and use simple logic see what line they are on and if they are being used correctly, and if not than fix them. As for the Class/Union/Struct I'm not too sure about, but if I had to guess it isn't in the correct place. Maybe you placed it outside of a class, or are missing something somewhere. But yeah you were right, most errors are attributed to 1 error, ussualy start at the top

missing ';' before identifier 'kServ'

that's the first error, if you fix it, than you most likely fixed another error as well.
MOOOOOO

Cletus
Posts: 18
Joined: December 7th, 2012, 6:56 pm

Re: need help: Lesson 8

Post by Cletus » December 8th, 2012, 3:35 am

first off...please dont flame me...im a nice guy -_-

second...i never did a thing to most of that error list...alot of that is in windows.cpp, which i never touched, so obviously, thats not where the error is...i have something that is messing with it. That explains the class/struct/union, now...for the int errors...those values shouldn't need an int before them. chili never placed ints on them before, neither did i...and it worked....till now.

so...before you try to make someone feel like an ass, and or dumass...look at yourself first

*EDIT*

this is the line which you are speaking of

#include "resource.h"

static KeyboardServer kServ;

i have a feeling i would get a much greater bucket o' worms if i put a ";" anywhere before kserv
Image
Consistency is the hobgoblin of the small mind ~Terrance McKenna~

poschi
Posts: 9
Joined: November 28th, 2012, 1:08 am
Location: Germany

Re: need help: Lesson 8

Post by poschi » December 8th, 2012, 4:32 am

Yes this was really a tough bug. Took me some mins to find him.

To make it short, here are the two mistakes:

Game.h

Code: Select all

class Game
{
.......
	int poo3X;
	int poo3Y;
	bool isPoo3Eaten;
	/********************************/
} //<-!!!!!!!!!!!!!!!!!!Missing semicolon at the end of the class!!!!!!!!!!!!
I hope you won't do that again:P

Second one:

Game.cpp

Code: Select all

Game::Game( HWND hWnd,const KeyboardServer& kServer ), //No comma here!!!!!!!
:	gfx ( hWnd ),
	kbd( kServer ),
	faceX( 400 ),
	faceY( 300 )
{}
Now it compiles for me fine. :mrgreen:

Cletus
Posts: 18
Joined: December 7th, 2012, 6:56 pm

Re: need help: Lesson 8

Post by Cletus » December 8th, 2012, 6:15 am

wow thank you very much...you are TeH awesome =]...I was beginning to think i would just get people telling me how stupid i am -_-*

i dont know how the hell i managed to get rid of the semicolon in game.h and the 2nd error was actually trying to fix the 1st -_- (i had to try right?...wont learn anything if i dont fk up xD)

anyway...thanks dude...after the last guy...well....lets just say im glad there are people like you here




WOO! i can finally continue...damm its midnight...oh well...ZzZzZz
Image
Consistency is the hobgoblin of the small mind ~Terrance McKenna~

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

Re: need help: Lesson 8

Post by chili » December 9th, 2012, 9:04 am

Nah, codinitup is a cool guy. Sometimes it gets frustrating when you see the same kind of mistakes over and over and you might jump the gun a bit. :lol:

I still miss semicolons all the time. :p But I know the symptoms when I see them so I can tell pretty quick where the problem lies. Good luck with the tutorials, they get waaaay harder and longer after lesson 8 :twisted:
Chili

Cletus
Posts: 18
Joined: December 7th, 2012, 6:56 pm

Re: need help: Lesson 8

Post by Cletus » December 9th, 2012, 5:01 pm

yeah i suppose i can't really blame him too much...it does get aggravating taking time out of your day to fix someone else's mistakes...but that doesn't really give anybody the right to talk to someone like they're stupid...you gotta remember that although you guys may be comfortable with programming, for someone like me its kinda like staring into the abyss, and I actually had a pretty good basic knowledge of C++ commands and syntax before i got here. Actually, what i love about these tuts is that you show many different kinds of logic used with the commands, instead of just saying "this command does this", which is what i've been looking for

anyway...long post for not much more reason than venting i guess.

i gots no qualms with you codinitup, just try to be nice to the nublets like me plz T_T

and thx again to poschi....you took time out of your day and saved me from going back through 7 tuts....much appreciated =]

*EDIT*

Just so i can keep myself from doing this in the future...i have a quick question.

When building a class i've gathered that you need a semicolon on the end of the brackets just as a standard, am i correct?...
Image
Consistency is the hobgoblin of the small mind ~Terrance McKenna~

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

Re: need help: Lesson 8

Post by chili » December 10th, 2012, 12:32 pm

Yeah, classes, structs, enums, unions...

Any user-defined compound type is gonna need that semicolon after the brackets.
Chili

Post Reply