Snekgame unresolved externals
Re: Snekgame unresolved externals
Hi,
I added the code.
Thanks!
I added the code.
Thanks!
- Attachments
-
- snekgame.zip
- (603.53 KiB) Downloaded 180 times
Re: Snekgame unresolved externals
Hi Chili,
I added the snek. Thx!
I added the snek. Thx!
- Attachments
-
- snekgame.zip
- (603.53 KiB) Downloaded 160 times
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Snekgame unresolved externals
Snek Tutorial 14a at 28 min 55 sec
At this point in the video chili creates the definitions for the functions you are missing.
Unresolved externals usually means that the compiler can't find a variable or function that is being used or called. In this case, it's all the Snake::Segment functions that you did not define. You have them declared, but not defined and the Snake functions call some of them like Snake::Segment::MoveBy and Snake::Segment::Segment. Which means the compiler is being asked to use some code that it can't find, and it is telling you that you must be crazy.
Finish the video and define all the rest of the functions and see if that helps.
At this point in the video chili creates the definitions for the functions you are missing.
Unresolved externals usually means that the compiler can't find a variable or function that is being used or called. In this case, it's all the Snake::Segment functions that you did not define. You have them declared, but not defined and the Snake functions call some of them like Snake::Segment::MoveBy and Snake::Segment::Segment. Which means the compiler is being asked to use some code that it can't find, and it is telling you that you must be crazy.
Finish the video and define all the rest of the functions and see if that helps.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Snekgame unresolved externals
Oh, just found another issue you were having is the Snake::Snake having issues with missing Snake::Segment::Segment. It's because you added a constructor to Location ( which chili did not add ). Since you added a constructor, the compiler doesn't implicitly add the default constructor to Location. Which means Snake::Segment::Location loc needs to be initialized using a Snake::Segment::Segment constructor.
You have a few options:
Delete the constructor you made from Location
Add a default constructor to Location ( Location() = default; )
Add a constructor to Segment that initializes Snake::Segment::Location loc
You have a few options:
Delete the constructor you made from Location
Add a default constructor to Location ( Location() = default; )
Add a constructor to Segment that initializes Snake::Segment::Location loc
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Snekgame unresolved externals
Hopefully the version you downloaded has the SpriteCodex.h and SpriteCodex.cpp files, because the one you posted does not.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Snekgame unresolved externals
Tanks Albinopapa,I deleted the constructor for location. Now it works fine. But I still have a question:
I dont understand why this: "Location loc = { x,y };" works because how does Visual Studio know which variables I want to change in loc object?
I dont understand why this: "Location loc = { x,y };" works because how does Visual Studio know which variables I want to change in loc object?
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Snekgame unresolved externals
Well, the {x,y} creates a temporary Location by storing each variable consecutively in memory, then assigns that data to Location loc. So if you had done Location loc = {y, x} loc.x would have been what your y was and loc.y would have been what your x was when you passed them in.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Snekgame unresolved externals
Cool, maybe it's a stupid question, but how does the computer know that when I write Location loc = {x,y}; I want the x to be stored in loc.x and not in loc.y or in any other variable?
misterchi
misterchi
Re: Snekgame unresolved externals
it's done according to the order in which you declare the variables in the class/struct
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Snekgame unresolved externals
Yeah, I kind of explained that already.misterchi wrote:Cool, maybe it's a stupid question, but how does the computer know that when I write Location loc = {x,y}; I want the x to be stored in loc.x and not in loc.y or in any other variable?
misterchi
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com