Unresolved externals caused by unused variables?

Grab your favourite IDE and tinker with the innards of game engines

Unresolved externals caused by unused variables?

Postby nanoxax on Sun Mar 18, 2012 5:01 pm

I have this chunck of code:
Code: Select all
   virtual void CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov );

In c_BaseCombatCharacter.h

I have it referenced where it is supposed to be and I have everything mapped out no errors prior to linkage or anything.

And then it says this:

Code: Select all
c_weapon_hopwire.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_strider.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_te_flare.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_vort_charge_token.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z) referenced in function "public: class Vector __thiscall Vector::operator+(class Vector const &)const " (??HVector@@QBE?AV0@ABV0@@Z)
c_weapon_crossbow.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_npc_combinegunship.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_npc_manhack.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_npc_puppet.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_npc_rollermine.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_barnacle.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_barney.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_basehelicopter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_npc_antlionguard.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
basegrenade_shared.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_ai_basenpc.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_basecombatcharacter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_baseplayer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
c_baseplayer.obj : error LNK2001: unresolved external symbol "public: virtual class IRagdoll * __thiscall C_BasePlayer::GetRepresentativeRagdoll(void)const " (?GetRepresentativeRagdoll@C_BasePlayer@@UBEPAVIRagdoll@@XZ)
c_basehlplayer.obj : error LNK2001: unresolved external symbol "public: virtual class IRagdoll * __thiscall C_BasePlayer::GetRepresentativeRagdoll(void)const " (?GetRepresentativeRagdoll@C_BasePlayer@@UBEPAVIRagdoll@@XZ)
ragdoll.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CRagdoll::LookupAttachment(char const *)" (?LookupAttachment@CRagdoll@@UAEHPBD@Z)
ragdoll.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall CRagdoll::GetAttachment(int,class Vector &,class QAngle)" (?GetAttachment@CRagdoll@@UAE_NHAAVVector@@VQAngle@@@Z)


This leads me to believe that all these errors, are caused by the variable that I defined not being in use for these codes.

How do I make the defined variable only work with C_BasePlayer.cpp and not have to be referenced in any other code. But if this isn't the problem and there is a different solution to it please enlighten me.

I'm using this tutorial:
https://developer.valvesoftware.com/wiki/First_Person_Ragdolls

And I'm attempting to implement it into my singleplayer mod, if that helps any.
nanoxax
Member
Member
 
Joined: Tue Oct 18, 2011 8:14 pm

Re: Unresolved externals caused by unused variables?

Postby zombie@computer on Sun Mar 18, 2012 6:40 pm

Code: Select all
error LNK2001: unresolved external symbol "public: virtual void __thiscall C_BaseCombatCharacter::CalcView(class Vector &,class QAngle &,float &,float &,float &)" (?CalcView@C_BaseCombatCharacter@@UAEXAAVVector@@AAVQAngle@@AAM22@Z)
Means you declared this function but didnt define it (=wrote the contents of the function).

What variable are you talking about?
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Unresolved externals caused by unused variables?

Postby nanoxax on Sun Mar 18, 2012 7:07 pm

Sorry for my vocabulary, when I say variable I mean function, specifically this function:
Code: Select all
   virtual void CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov );


I don't want to define it in every file that the error comes up in, I've already defined it in the file that needs it. How do I make it so that the other files that come up with problems shut the hell up when they ask for the function that they don't need. That is what I need to know.
nanoxax
Member
Member
 
Joined: Tue Oct 18, 2011 8:14 pm

Re: Unresolved externals caused by unused variables?

Postby zombie@computer on Sun Mar 18, 2012 7:49 pm

nanoxax wrote:Sorry for my vocabulary, when I say variable I mean function, specifically this function:
Code: Select all
   virtual void CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov );


I don't want to define it in every file that the error comes up in, I've already defined it in the file that needs it. How do I make it so that the other files that come up with problems shut the hell up when they ask for the function that they don't need. That is what I need to know.
the errors say you havent defined the function at all, you just declared it. So just define it and you should be al right.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Return to Programming

Who is online

Users browsing this forum: No registered users