Using the engine plugin, I created the object in the plugin compiler after the LINK ERROR, I like the following use:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UObjectPlugin" });
And then create an instance of the plug-in that inherits from UObject:
#include "TestNullProject.h"
#include "TestNullProjectGameMode.h"
#include "MyPluginObject.h"
void ATestNullProjectGameMode::StartPlay()
{
Super::StartPlay();
UMyPluginObject* MyPluginObject = NewObject<UMyPluginObject>();
}
LINKERROR appears at compile time:
2>TestNullProjectGameMode.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UMyPluginObject::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UMyPluginObject@@CAPEAVUClass@@PEB_W@Z),referenced in function "class UMyPluginObject * __cdecl NewObject<class UMyPluginObject>(class UObject *)" (??$NewObject@VUMyPluginObject@@@@YAPEAVUMyPluginObject@@PEAVUObject@@@Z)
2>D:\Unreal Projects\TestNullProject\Binaries\Win64\UE4Editor-TestNullProject-6519.dll : fatal error LNK1120: 1 unresolved externals
2>ERROR : UBT error : Failed to produce item: D:\Unreal Projects\TestNullProject\Binaries\Win64\UE4Editor-TestNullProject-6519.dll
use it with wrong way?