Acessing same class object throughout whole game.

The Partridge Family were neither partridges nor a family. Discuss.
cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Acessing same class object throughout whole game.

Post by cameron » November 4th, 2012, 8:37 pm

I thought I got my income wars game set since I now understand pointers. But, apparently not.

I get this:
1>------ Build started: Project: Chili DirectX Framework, Configuration: Debug Win32 ------
1>Game.obj : error LNK2019: unresolved external symbol "public: void __thiscall turret::attack(int,int,int,int,int,int,class Marine *)" (?attack@turret@@QAEXHHHHHHPAVMarine@@@Z) referenced in function "private: void __thiscall Game::ComposeFrame(void)" (?ComposeFrame@Game@@AAEXXZ)
1>C:\Users\cameron\Desktop\Income wars7 - Copy (2) - Copy\Chili DirectX Framework V12.04.24 (SFX)\Debug\Chili DirectX Framework.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
for calling:
tur.attack(50,50,50,100,5,5,&mar);



Again sorry for needing help. I found intermediate lesson 3 was very informational and helpful for understanding references and pointers it all just made sense after seeing that.
Last edited by cameron on November 6th, 2012, 1:00 am, edited 1 time in total.
Computer too slow? Consider running a VM on your toaster.

adabo
Posts: 154
Joined: October 27th, 2012, 3:28 am
Location: Houston, Texas

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by adabo » November 4th, 2012, 9:38 pm

Needing help is something to be sorry for. In fact, asking for help takes courage and a bit of humility. So in the most genuine of cases, asking for help is an admirable thing.

Regards to your error, I don't see how it relates to pointers. It looks like a class related issue. Something to do with public/private maybe?

I don't know how classes work in c++ yet, so I'll just stop at that for now. Hope that helps.

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by LuX » November 4th, 2012, 9:47 pm

You would have to upload the project
ʕ •ᴥ•ʔ

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

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by cameron » November 4th, 2012, 10:17 pm

lol I was about to do that I cleaned it and everything but never clicked the add file button lol here you go.
Attachments
Income wars7 - Copy (2) - Copy - Copy.rar
(785.99 KiB) Downloaded 168 times
Computer too slow? Consider running a VM on your toaster.

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

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by cameron » November 5th, 2012, 1:05 am

Does this have anything to do with class objects?
Computer too slow? Consider running a VM on your toaster.

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by LuX » November 5th, 2012, 1:26 pm

Kinda... Take another look at enemybase.cpp "attack" function.
ʕ •ᴥ•ʔ

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

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by cameron » November 5th, 2012, 2:03 pm

I think it has something to do with that Marine* marin paramiter, not sure though.
Computer too slow? Consider running a VM on your toaster.

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by LuX » November 5th, 2012, 7:57 pm

Nah it's just a silly mistake you made. Pay closer attention to the first line.
ʕ •ᴥ•ʔ

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

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by cameron » November 5th, 2012, 10:09 pm

Oh I forgot the scope lol.
Computer too slow? Consider running a VM on your toaster.

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

Re: Trouble again.:( error LNK2019: unresolved external symb

Post by cameron » November 5th, 2012, 11:34 pm

Although I am passing the wrong instance of marine to the attack function.Ill have to fix that.
Computer too slow? Consider running a VM on your toaster.

Post Reply