[solved] Stuck on beginner lesson 20

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Caleb7
Posts: 7
Joined: December 22nd, 2012, 8:26 am

[solved] Stuck on beginner lesson 20

Post by Caleb7 » December 22nd, 2012, 8:33 am

I can't seem to find where my errors are, hopefully someone can enlighten me.

Sprite dude; is declared in Game.h and the Sprite struct is in D3DGraphics.h
D3DGraphics.h is included in Game.h and I'm a bit stumped.

Started with a fresh framework download and followed the video again. I got the exact same outcome. I'm sure I am making a mistake somewhere but I can't seem to figure it out.

Cleaned the source folder and uploaded.

1>------ Build started: Project: Chili DirectX Framework, Configuration: Debug Win32 ------
1> D3DGraphics.cpp
d3dgraphics.cpp(30): error C2065: 'dude' : undeclared identifier
d3dgraphics.cpp(30): error C2228: left of '.height' must have class/struct/union
1> type is ''unknown-type''
d3dgraphics.cpp(31): error C2065: 'dude' : undeclared identifier
d3dgraphics.cpp(31): error C2228: left of '.width' must have class/struct/union
1> type is ''unknown-type''
d3dgraphics.cpp(32): error C2065: 'dude' : undeclared identifier
d3dgraphics.cpp(32): error C2228: left of '.key' must have class/struct/union
1> type is ''unknown-type''
d3dgraphics.cpp(33): error C2065: 'dude' : undeclared identifier
d3dgraphics.cpp(33): error C2228: left of '.surface' must have class/struct/union
1> type is ''unknown-type''
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Attachments
20.rar
(155.83 KiB) Downloaded 149 times
Last edited by Caleb7 on December 24th, 2012, 9:19 pm, edited 1 time in total.

User avatar
natox1986
Posts: 53
Joined: December 14th, 2012, 1:11 pm

Re: Stuck on beginner lesson 20

Post by natox1986 » December 22nd, 2012, 12:14 pm

What seems to be the problem is that you forgot to create your object.
So, you made a struct called Sprite, but then you start talking about the dude. object while you did not even declare the object.

So if you add 'Sprite dude;' to D3DGraphics.cpp (above the function that calls for the dude. object) you should be fine...

** Edit: I'm just a newbie, so correct me if I'm wrong, but that actually drawed the character on my screen for me and it compiled without actual errors **
Image

Caleb7
Posts: 7
Joined: December 22nd, 2012, 8:26 am

Re: Stuck on beginner lesson 20

Post by Caleb7 » December 22nd, 2012, 1:59 pm

Turns out I was just using the wrong sprite name. In the video the LoadSprite function changes dude to sprite (just for the function) and I missed that. Though if I hadn't read your suggestion, I wouldn't have tried it, got a new error, and realized what I did. So with that, thanks Natox! :)

Musi
Posts: 106
Joined: November 25th, 2012, 1:06 am

Re: Stuck on beginner lesson 20

Post by Musi » December 22nd, 2012, 2:05 pm

Edit: Ah you found it, never mind.
Musi

There are 10 types of people that understand binary.
Those that do, and those that don't.

Caleb7
Posts: 7
Joined: December 22nd, 2012, 8:26 am

Re: Stuck on beginner lesson 20

Post by Caleb7 » December 22nd, 2012, 2:07 pm

I JUST figured it out. That was exactly what was wrong! :)

User avatar
natox1986
Posts: 53
Joined: December 14th, 2012, 1:11 pm

Re: Stuck on beginner lesson 20

Post by natox1986 » December 22nd, 2012, 4:14 pm

Caleb7 wrote:Turns out I was just using the wrong sprite name. In the video the LoadSprite function changes dude to sprite (just for the function) and I missed that. Though if I hadn't read your suggestion, I wouldn't have tried it, got a new error, and realized what I did. So with that, thanks Natox! :)
Then I don't get it mate... could you explain?

Because according to my findings you make a function called 'LoadSprite' that uses the 'dude.*' object in 'D3DGraphics.cpp', but it does not recognize the 'dude.*' object because it is not initialized in any corresponding header file. But apparently I'm wrong on that one...
So what happened?
Image

Caleb7
Posts: 7
Joined: December 22nd, 2012, 8:26 am

Re: Stuck on beginner lesson 20

Post by Caleb7 » December 22nd, 2012, 4:58 pm

natox1986 wrote:
Caleb7 wrote:Turns out I was just using the wrong sprite name. In the video the LoadSprite function changes dude to sprite (just for the function) and I missed that. Though if I hadn't read your suggestion, I wouldn't have tried it, got a new error, and realized what I did. So with that, thanks Natox! :)
Then I don't get it mate... could you explain?

Because according to my findings you make a function called 'LoadSprite' that uses the 'dude.*' object in 'D3DGraphics.cpp', but it does not recognize the 'dude.*' object because it is not initialized in any corresponding header file. But apparently I'm wrong on that one...
So what happened?
The LoadSprite function takes a sprite called "sprite" but I wrote "dude"

Post Reply