UE5: About Build Error LNK2001 and LNK2019

1>SAction.cpp.obj : error LNK2019:unresolved external symbol “__declspec(dllimport) public: __cdecl FGameplayTagContainer::FGameplayTagContainer(void)” (_imp ??0FGameplayTagContainer@@QEAA@XZ),referenced in function “public: __cdecl USAction::USAction(class FObjectInitializer const &)” (??0USAction@@QEAA@AEBVFObjectInitializer@@@Z)

1>SActionComponent.cpp.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __cdecl FGameplayTagContainer::FGameplayTagContainer(void)” (_imp ??0FGameplayTagContainer@@QEAA@XZ)

1>SAction.gen.cpp.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __cdecl FGameplayTagContainer::FGameplayTagContainer(void)” (_imp ??0FGameplayTagContainer@@QEAA@XZ)

I can find function “FGameplayTagContainer::FGameplayTagContainer(void)” in “GameplayTagContainer.h”, and I have included it (“GameplayTagContainer.h”) in “SAction.h”.

I think the function “FGameplayTagContainer::FGameplayTagContainer(void)” is probably the constructor of FGameplayTagContainer.

This is the implementation of the function “FGameplayTagContainer::FGameplayTagContainer(void)” in “GameplayTagContainer.h”.

USTRUCT(BlueprintType, meta = (HasNativeMake = "GameplayTags.BlueprintGameplayTagLibrary.MakeGameplayTagContainerFromArray", HasNativeBreak = "GameplayTags.BlueprintGameplayTagLibrary.BreakGameplayTagContainer"))
struct GAMEPLAYTAGS_API FGameplayTagContainer
{
	GENERATED_USTRUCT_BODY()

	/** Constructors */
	FGameplayTagContainer()
	{
	}
...

Why does it still report an error?

Add “GameplayTags” to your PublicDependencyModuleNames in your Build.cs file.

2 Likes