Unresolved External Symbol

For some reason my code is hitting a compile error? All the .H files are included as necceasry, am I missing something important?

1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommePickup::ReceiveActorBeginOverlap(class AActor *)” (?ReceiveActorBeginOverlap@ATheSommePickup@@UEAAXPEAVAActor@@@Z)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl ATheSommePickup::CanBePickedUp(class ASommeCharacter *)const " (?CanBePickedUp@ATheSommePickup@@UEBA_NPEAVASommeCharacter@@@Z)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommePickup::BeginPlay(void)” (?BeginPlay@ATheSommePickup@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “protected: virtual void __cdecl ATheSommePickup::GivePickupTo(class ATheSommeCharacter *)” (?GivePickupTo@ATheSommePickup@@MEAAXPEAVATheSommeCharacter@@@Z)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::ServerStopsFire_Implementation(void)” (?ServerStopsFire_Implementation@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::ServerStopReload_Implementation(void)” (?ServerStopReload_Implementation@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::ServerStartsFire_Implementation(void)” (?ServerStartsFire_Implementation@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::ServerStartReload_Implementation(void)” (?ServerStartReload_Implementation@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::ServerHandleFiring_Implementation(void)” (?ServerHandleFiring_Implementation@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::ClientStartReload_Implementation(void)” (?ClientStartReload_Implementation@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual int * __cdecl ATheSommeWeapon::GetReplicationList(unsigned char *,struct FPropertyRetirement *,int *,class UPackageMap *,class UActorChannel *,struct FReplicationFlags)” (?GetReplicationList@ATheSommeWeapon@@UEAAPEAHPEAEPEAUFPropertyRetirement@@PEAHPEAVUPackageMap@@PEAVUActorChannel@@UFReplicationFlags@@@Z)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::Destroyed(void)” (?Destroyed@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::StartFire(void)” (?StartFire@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::StopFire(void)” (?StopFire@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::StartReload(bool)” (?StartReload@ATheSommeWeapon@@UEAAX_N@Z)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::StopReload(void)” (?StopReload@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ATheSommeWeapon::ReloadWeapon(void)” (?ReloadWeapon@ATheSommeWeapon@@UEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2019: unresolved external symbol “protected: void __cdecl ATheSommeWeapon::OnRep_MyPawn(void)” (?OnRep_MyPawn@ATheSommeWeapon@@IEAAXXZ) referenced in function “public: void __cdecl ATheSommeWeapon::execOnRep_MyPawn(struct FFrame &,void * const)” (?execOnRep_MyPawn@ATheSommeWeapon@@QEAAXAEAUFFrame@@QEAX@Z)
1>Module.TheSomme.cpp.obj : error LNK2019: unresolved external symbol “protected: void __cdecl ATheSommeWeapon::OnRep_BurstCounter(void)” (?OnRep_BurstCounter@ATheSommeWeapon@@IEAAXXZ) referenced in function “public: void __cdecl ATheSommeWeapon::execOnRep_BurstCounter(struct FFrame &,void * const)” (?execOnRep_BurstCounter@ATheSommeWeapon@@QEAAXAEAUFFrame@@QEAX@Z)
1>Module.TheSomme.cpp.obj : error LNK2019: unresolved external symbol “protected: void __cdecl ATheSommeWeapon::OnRep_Reload(void)” (?OnRep_Reload@ATheSommeWeapon@@IEAAXXZ) referenced in function “public: void __cdecl ATheSommeWeapon::execOnRep_Reload(struct FFrame &,void * const)” (?execOnRep_Reload@ATheSommeWeapon@@QEAAXAEAUFFrame@@QEAX@Z)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “protected: virtual void __cdecl ATheSommeWeapon::OnBurstStarted(void)” (?OnBurstStarted@ATheSommeWeapon@@MEAAXXZ)
1>Module.TheSomme.cpp.obj : error LNK2001: unresolved external symbol “protected: virtual void __cdecl ATheSommeWeapon::OnBurstFinished(void)” (?OnBurstFinished@ATheSommeWeapon@@MEAAXXZ)
1>E:\TheSommeUE4\TheSomme\Binaries\Win64\RocketEditor-TheSomme.dll : fatal error LNK1120: 22 unresolved externals

This is an error on your end.

Did you include the function in your .h file?

please show your .h file

did you include the function in your .cpp file?

please show your .cpp file

#ATheSommePickup::

Did you include the

ATheSommePickup::

in your .cpp function definition?

Rama

Not all of these functions have been utilized in the .cpp file yet, but yeah the Header is Included :slight_smile:

So, every function I declare in the Header file must be used in the .cpp file too?

#Virtual

if it is virtual yes, you either include a empty definition {}

or you make it pure virtual with = 0; in the .h file

but that could get confusing if you are just delaying implementation rather than deferring to subclass

so I’d recommend an empty definition if it is planned to be implemented in that class later

PS: if this answers your question please check mark my answer

Thanks rama :slight_smile:

This is the answer I came here to find. Thanks.

Hi! Ambak.
Please check file .Build.cs

add to PublicDependencyModuleNames AIModule

PublicDependencyModuleNames.AddRange(new string[] { …, “AIModule” });

see more UBTTaskNode | Unreal Engine Documentation

Hope this helps!

Hi,
I was looking for an answer to a similar error that I got when I created a BTTaskNode (C++). It starts to give all these errors after you do a add new class from the content browser.
Maybe like many other classes the editor can generate the boiler plate for this class as well, just a thought, I know why the error and have solved it looking at this post, so thanks for that…

Hi, Thanks ,

yea the AIModule was already in there, I’m pretty sure the problem was the Interface IGameplayTaskOwnerInterface that the class UBTNode implements which is in turn is extended by BTTaskNode.
The guilty method:
virtual void OnGameplayTaskActivated(UGameplayTask& Task)

Not a C++ expert, and was expecting to see the override keyword on the method to indicate that, in Java for example you have to implement all interface methods or declare your class abstract (sorry not drawing any language comparisons). didn’t strike me that virtual would do the same thing, and probably the other functions in the interface have already been given implementation in the inheritance chain…

But I think this is what Rama suggested in response to the post above.
I just gave it an empty implementation and boom, the code compiled…