Snekgame unresolved externals

The Partridge Family were neither partridges nor a family. Discuss.
misterchi
Posts: 20
Joined: November 12th, 2016, 3:15 pm

Snekgame unresolved externals

Post by misterchi » March 26th, 2017, 11:02 am

Why these bugs?

10k you
Attachments
snekgame.zip
(603.53 KiB) Downloaded 158 times

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: Snekgame unresolved externals

Post by Zedtho » March 26th, 2017, 11:33 am

I'll check this later, but what do you mean with "10k you"?

misterchi
Posts: 20
Joined: November 12th, 2016, 3:15 pm

Re: Snekgame unresolved externals

Post by misterchi » March 26th, 2017, 12:14 pm

read it fast :D

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

Re: Snekgame unresolved externals

Post by chili » March 26th, 2017, 1:01 pm

Code: Select all

Snake.obj : error LNK2019: unresolved external symbol "public: __cdecl Snake::Segment::Segment(void)" (??0Segment@Snake@@QEAA@XZ) referenced in function "public: __cdecl Snake::Snake(struct Location const &)" (??0Snake@@QEAA@AEBULocation@@@Z)
1>Snake.obj : error LNK2019: unresolved external symbol "public: void __cdecl Snake::Segment::InitHead(struct Location const &)" (?InitHead@Segment@Snake@@QEAAXAEBULocation@@@Z) referenced in function "public: __cdecl Snake::Snake(struct Location const &)" (??0Snake@@QEAA@AEBULocation@@@Z)
1>Snake.obj : error LNK2019: unresolved external symbol "public: void __cdecl Snake::Segment::Follow(class Snake::Segment const &)" (?Follow@Segment@Snake@@QEAAXAEBV12@@Z) referenced in function "public: void __cdecl Snake::MoveBy(struct Location const &)" (?MoveBy@Snake@@QEAAXAEBULocation@@@Z)
1>Snake.obj : error LNK2019: unresolved external symbol "public: void __cdecl Snake::Segment::Draw(class Board &)" (?Draw@Segment@Snake@@QEAAXAEAVBoard@@@Z) referenced in function "public: void __cdecl Snake::Draw(class Board &)" (?Draw@Snake@@QEAAXAEAVBoard@@@Z)
You don't have any implementations for any of these functions. That's what the errors say.
Chili

misterchi
Posts: 20
Joined: November 12th, 2016, 3:15 pm

Re: Snekgame unresolved externals

Post by misterchi » March 26th, 2017, 1:28 pm

Ok.

Do you know why Visual Studio underlines the brace in the picture I added?

misterchi
Attachments
underlined brace.PNG
underlined brace.PNG (4.9 KiB) Viewed 3374 times

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

Re: Snekgame unresolved externals

Post by chili » March 26th, 2017, 1:39 pm

If you put your cursor on the underlined part it will tell you.

My guess is you have some embedded object with no default constructor and it cannot instantiate it.
Chili

misterchi
Posts: 20
Joined: November 12th, 2016, 3:15 pm

Re: Snekgame unresolved externals

Post by misterchi » March 27th, 2017, 5:32 pm

Hi,

it says: the default constructor of "Snake::Segment" cannot be referenced-- it is a deleted function

What should I do? I programmed the same like you did in the Tutorial 14a.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Snekgame unresolved externals

Post by albinopapa » March 27th, 2017, 7:09 pm

Do you have a line in class Snake::Segment like
Snake::Segment() = default;
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

misterchi
Posts: 20
Joined: November 12th, 2016, 3:15 pm

Re: Snekgame unresolved externals

Post by misterchi » March 28th, 2017, 3:19 pm

No, I don't have that line. But when I add a constructor the red underline disappears. The odd thing is that I did it like Chili did and his program works.

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

Re: Snekgame unresolved externals

Post by chili » March 28th, 2017, 3:37 pm

I can 100% guarantee that you didn't do it like me :D

If you wanna know what you missed, post your full code (the non working stuff) and I'll take a look at it.
Chili

Post Reply