Download

I can't open C++ project on Unreal Engine 4.14


The project could not be compiled. Would you like to open it in Visual Studio?

Running C:/Program Files (x86)/Epic Games/4.14/Engine/Binaries/DotNET/UnrealBuildTool.exe UIDemo2 Development Win64 -project="C:/Users/cmozt/Desktop/UIDemo2/UIDemo2.uproject" -editorrecompile -progress -noubtmakefiles -NoHotReloadFromIDE
 @progress push 5%
Parsing headers for UIDemo2Editor
  Running UnrealHeaderTool "C:\Users\cmozt\Desktop\UIDemo2\UIDemo2.uproject" "C:\Users\cmozt\Desktop\UIDemo2\Intermediate\Build\Win64\UIDemo2Editor\Development\UIDemo2Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for UIDemo2Editor in 3,5512957 seconds
 @progress pop
Performing 7 actions (2 in parallel)
[2/7] Resource PCLaunch.rc
PCH.UIDemo2.h.cpp
[3/7] Resource ModuleVersionResource.rc.inl
UIDemo2GameModeBase.cpp
UIDemo2.generated.cpp
UIDemo2.cpp
[7/7] Link UE4Editor-UIDemo2.dll
   Creating library C:\Users\cmozt\Desktop\UIDemo2\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-UIDemo2.lib and object C:\Users\cmozt\Desktop\UIDemo2\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-UIDemo2.exp
UIDemo2GameModeBase.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AGameModeBase::SetPause(class APlayerController *,class TBaseDelegate<bool>)" (?SetPause@AGameModeBase@@UEAA_NPEAVAPlayerController@@V?$TBaseDelegate@_N$$$V@@@Z)
UIDemo2.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AGameModeBase::SetPause(class APlayerController *,class TBaseDelegate<bool>)" (?SetPause@AGameModeBase@@UEAA_NPEAVAPlayerController@@V?$TBaseDelegate@_N$$$V@@@Z)
C:\Users\cmozt\Desktop\UIDemo2\Binaries\Win64\UE4Editor-UIDemo2.dll : fatal error LNK1120: 1 unresolved externals
ERROR: UBT ERROR: Failed to produce item: C:\Users\cmozt\Desktop\UIDemo2\Binaries\Win64\UE4Editor-UIDemo2.dll
Total build time: 80,16 seconds


Can anyone advice me ?***

It says what the problem is right there in the log:

Basically, you reference AGameModeBase::SetPause, but the linker cannot find the implementation for it.
There are two possible cases:

  1. You called it somewhere: remove or substitute that call to see if that solves the problem
  2. You created a child class from AGameModeBase which is missing the SetPause function. Go and implement it in your class.

I just created the A C++ Class for Game Mode Base and got this error while it was being created. Is this a bug in the latest unreal version. (Mine is 4.14.3).

GameModeBase.h



virtual bool SetPause(APlayerController* PC, FCanUnpause CanUnpauseDelegate = FCanUnpause());


GameModeBase.cpp




bool AGameModeBase::SetPause(APlayerController* PC, FCanUnpause CanUnpauseDelegate /*= FCanUnpause()*/)
{
	if (AllowPausing(PC))
	{
		// Add it for querying
		Pausers.Add(CanUnpauseDelegate);

		// Let the first one in "own" the pause state
		AWorldSettings * WorldSettings = GetWorldSettings();
		if (WorldSettings->Pauser == nullptr)
		{
			WorldSettings->Pauser = PC->PlayerState;
		}
		return true;
	}
	return false;
}


I was able to compile it correctly once I added the same function to my class.

in the header file



public:
virtual bool SetPause(APlayerController* PC, FCanUnpause CanUnpauseDelegate = FCanUnpause());


in the cpp file



bool ACoinGameModeBase::SetPause(APlayerController* PC, FCanUnpause CanUnpauseDelegate /*= FCanUnpause()*/)
{
	if (AllowPausing(PC))
	{
		// Add it for querying
		Pausers.Add(CanUnpauseDelegate);

		// Let the first one in "own" the pause state
		AWorldSettings * WorldSettings = GetWorldSettings();
		if (WorldSettings->Pauser == nullptr)
		{
			WorldSettings->Pauser = PC->PlayerState;
		}
		return true;
	}
	return false;
}


Yes, as I said the linker did not find the implementation from the Game Mode Base class for your child class.

You wrote this is a bug, but this behavior is the default case for many classes from the UE4 source code. You only inherit the methods the classes export from their module (e.g. “Core” or “Slate”). If a class has the MinimalAPI annotation then you cannot call its methods from your code and you have to implement them yourself when you inherit from it. See here.

https://answers.unrealengine.com/questions/552964/gamemodebase-setpause-lnk2001.html

I posted it here. It pretty much happens without me doing anything (i just create the class on an empty project and get the error).

I had a similar problem when changing engine versions from 4.13 to 4.14 - they changed GameMode to GameModeBase. I don’t know if that might have anything to do with it.