Cannot declare native gameplay tag

I have this piece of code in UE5:

#pragma once
#include "NativeGameplayTags.h"

UE_DECLARE_GAMEPLAY_TAG_EXTERN(MY_NATIVE_TAG)
#include "Tags.h"

UE_DEFINE_GAMEPLAY_TAG(MY_NATIVE_TAG, "Native.Game.Tag")

First one is .h and second one is .cpp file.

When I compile, I get linker errors:

  LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FNativeGameplayTag::FNativeGameplayTag(class FName,class FName,class FName,class FString const &,enum ENativeGameplayTagToken)" (__imp_??0FNativeGameplayTag@@QEAA@VFName@@00AEBVFString@@W4ENativeGameplayTagToken@@@Z) referenced in function "void __cdecl `dynamic initializer for 'MY_NATIVE_TAG''(void)" (??__EMY_NATIVE_TAG@@YAXXZ)
  LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FNativeGameplayTag::~FNativeGameplayTag(void)" (__imp_??1FNativeGameplayTag@@QEAA@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'MY_NATIVE_TAG''(void)" (??__FMY_NATIVE_TAG@@YAXXZ)

How can I solve this problem?

1 Like

I figured it out why it’s spitting out some non-sense errors. I forgot to add GameplayTags module to dependency list of my gameplay module.

2 Likes

thanks you , i have the same problem :smiley: