Error LNK2019: unresolved external symbol GetPrivateStaticClass

Hi,

Today I’ve got infamous linker error while trying to use my custom class. The class is in the custom runtime module (i.e. created in the Engine/Source/Runtime/MyModule/Public/CustomAc.h)

// === HEADER ===

#pragma once

#include "Engine.h"
#include "CustomAc.generated.h"

UCLASS()
class MYMODULE_API UCustomAc : public UObject
{
	GENERATED_UCLASS_BODY()
};

// ALSO TRIED THIS

//UCLASS(MinimalAPI)
//class UCustomAc : public UObject
//{
//	GENERATED_UCLASS_BODY()
//};

// === CPP ===

#include "MyModule.h"
#include "CustomAc.h"

UCustomAc::UCustomAc(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
}

I’m using this class in UnrealEd module (dependency is added to the PrivateIncludePathModuleNames) like this (headers are included, the class itself is seen by the file)

...
#include "CustomAc.h"
...
UActorFactoryCustom::UActorFactoryCustom(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	DisplayName = LOCTEXT("PointLightDisplayName", "Point Light");
	NewActorClass = UCustomAc::StaticClass();
	SpawnPositionOffset = FVector(50, 0, 0);
	bUseSurfaceOrientation = true;
}

Of course I’m getting this when compiling:

*error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UCustomAc::GetPrivateStaticClass(wchar_t const )" (?GetPrivateStaticClass@UCustomAc@@CAPEAVUClass@@PEB_W@Z)

I’ve spent too many hours already on this and tried everything I know… Need help.

The solution was rather simple:

use PrivateDependencyModuleNames instead of PrivateIncludePathModuleNames in UnrealEd.build.cs

1 Like

Thanks for your thread I had the same issue !