Function ULevelStreaming::CreateInstance(class FString) unresolved external symbol when compiling

Hi, when compiling the following code:

void ALevelGenCpp::AllocationMapParts()
	FString LevInstName;

	FLatentActionInfo LatentActionInfo;

	LatentActionInfo.CallbackTarget = this;
	LatentActionInfo.ExecutionFunction = "TestCall";
	LatentActionInfo.UUID = 123;
	LatentActionInfo.Linkage = 0;

	ULevelStreaming *pStreaming = UGameplayStatics::GetStreamingLevel(GEngine->GetWorld(), "dsfd")->CreateInstance("55");
	pStreaming->LevelTransform = FTransform();
	UGameplayStatics::LoadStreamLevel(GEngine->GetWorld(), "55", true, false, LatentActionInfo);

I get error:

LevelGenCpp.cpp.obj : error LNK2019: ������ �� ������������� ������� ������ "public: class ULevelStreaming * __cdecl ULevelStreaming::CreateInstance(class FString)" (?CreateInstance@ULevelStreaming@@QEAAPEAV1@VFString@@@Z) � ������� "public: void __cdecl ALevelGenCpp::AllocationMapParts(void)" (?AllocationMapParts@ALevelGenCpp@@QEAAXXZ)

PS: I found Question with the same problem:

Hey Deema_35-

The compiler doesn’t recognize the pStreaming pointer’s type. Adding an include statement for LevelStreaming.h should identify what pStreaming is to the compiler and solve the compile errors.


Doug Wilson

This is not work, because this is not error compiler, this is error linker. It can not find external symbol.
I am publish error again because in last time I have problems with localization VS.

1>LevelGenCpp.cpp.obj : error LNK2019: unresolved external symbol “public: class ULevelStreaming * __cdecl ULevelStreaming::CreateInstance(class FString)” (?CreateInstance@ULevelStreaming@@QEAAPEAV1@VFString@@@Z) referenced in function “public: void __cdecl ALevelGenCpp::PlacedCustomLevelParts(void)” (?PlacedCustomLevelParts@ALevelGenCpp@@QEAAXXZ)
1>D:\Unreal Projects\TCofK\Binaries\Win64\UE4Editor-TCofK.dll : fatal error LNK1120: 1 unresolved externals

The ULevelStreaming class is marked as MinimalAPI in the source code which only exposes the bare minimum of that class to be called outside that class. If you are using a source build of the engine you can edit LevelStreaming.h to change the UCLASS specifier from MInimalAPI to EngineAPI.

I have the same issue. I would like to start with that I have tried changing line 78 of LevelStreaming.h from minimalAPI to EngineAPI, and the problem still persists I have also tried changing Line 79 to say class ENGINE_API ULevelStreaming : public UObject; and removed all the other calls to ENGINE_API. I have also tried adding a ENGINE_API on line 293 and none of these have worked. The code that causes the link error is simple because I’m trying to get it to build.

#include “LevelSpawnTest.h”
#include “Engine/LevelStreaming.h”

void LevelSpawnTest::CreateNewWorld(FString pName, ULevelStreaming* pLevelType, FTransform pTransform) {

I know that this is an older question but if there is a fix it would greatly help, or if there is a better way to make it so that I can randomly generate a tower with X amount of floors loading each floor independently.