Keywords: UE4, Plugin, LNK2019, GetPrivateStaticClass

UE4 Plugin Link Error:

Error    LNK2019    unresolved external symbol "private: static class UClass * __cdecl UMyComponent::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UMyComponent@@CAPEAVUClass@@XZ) referenced in function "class UMyComponent * __cdecl NewObject<class UMyComponent>(class UObject *)" (??$NewObject@VUMyComponent@@@@YAPEAVUMyComponent@@PEAVUObject@@@Z)    ClimbWall    
Case 1:

Maybe you removed UE4’s macro in your headers.

Add UE4 stylized macro MYPLUGIN_API in headers, e.g.:

class MYPLUGIN_API UMyComponent : public UActorComponent

Ensure all headers of your plugin have been added macro MYPLUGIN_API(even raw classes), otherwise there’s a compilication error LNK2019 if your plugin header was included in other Modules or game project.

Case 2:

Maybe you included a header in your project, but didn’t include module name of header in .Build.cs.
e.g., you included Editor.h, but you didn’t add UnrealEd into PrivateDependencyModuleNames in [YourProj].Build.cs.

new string[]
Case 3:

Maybe you declare a function but the defination lost.

void fun01();

void AMyActor::BeginPlay()