Unresolved External Symbols

I’ve had this problem for a couple of days now, been trying to fix it for ages, but I couldnt find anything online. Here is the .h file:

#pragma once

#include "CoreMinimal.h"
#include "AIController.h"
#include "Runtime/AIModule/Classes/Navigation/PathFollowingComponent.h"
#include "PacmanGhostController.generated.h"

/**
 * 
 */
UCLASS()
class ARCADEGAMES_API APacmanGhostController : public AAIController
{
	GENERATED_BODY()
	
public:
	
	APacmanGhostController();

	void Possess(class APawn* InPawn) override;

	void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult & Result);
	
	void SearchNewPoint();
	void GoHome();
	void Rearm();
	void StopMove();

private:
	class APacmanGhost* Bot;
	FVector HomeLocation;
	FTimerHandle TimerDead;
	
};

.cpp:
#include “PacmanGhostController.h”
#include “PacmanGhost.h”
#include “AIController.h”
#include “TimerManager.h”
#include “Runtime/NavigationSystem/Public/AbstractNavData.h”
#include “NavigationSystem.h”

APacmanGhostController::APacmanGhostController() {};

void APacmanGhostController::Possess(class APawn* InPawn)
{
	Super::Possess(InPawn);

	Bot = Cast<APacmanGhost>(InPawn);

	HomeLocation = Bot->GetActorLocation();
	SearchNewPoint();
}


void APacmanGhostController::GoHome()
{
	MoveToLocation(HomeLocation);
	GetWorldTimerManager().SetTimer(TimerDead, this, &APacmanGhostController::Rearm, 5.0f, false);
}

void APacmanGhostController::Rearm()
{

	GetWorldTimerManager().ClearTimer(TimerDead);
	Bot->Rearm();

}

void APacmanGhostController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult & Result)
{

	if (!Bot->bIsDead) 
	{ 
		SearchNewPoint();
	}

}

void APacmanGhostController::StopMove()
{

	StopMovement();

}

void APacmanGhostController::SearchNewPoint()
{
	UNavigationSystemV1* NavMesh = UNavigationSystemV1::GetCurrent(());
	if (NavMesh)
	{
		const float SearchRadius = 10000.0f;
		FVector RandomPt;
		bool bFound = NavMesh->K2_GetRandomReachablePointInRadius(this, Bot->GetActorLocation(), RandomPt, SearchRadius);
		if (bFound)
		{
			MoveToLocation(RandomPt);
		}
	}
}

Output:

1>------ Build started: Project: ArcadeGames, Configuration: Development_Editor x64 ------
1>Creating makefile for hot reloading ArcadeGamesEditor (modules to compile have changed)
1>Compiling game modules for hot reload
1>Using Visual Studio 2017 14.15.26726 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 1 action with 4 processes...
1>  [1/1] UE4Editor-ArcadeGames-1823.dll
1>     Creating library E:\FunStuff\Unreal Engine\4Projects\1C++\ArcadeGames\Intermediate\Build\Win64\UE4Editor\Development\ArcadeGames\UE4Editor-ArcadeGames-1823.suppressed.lib and object E:\FunStuff\Unreal Engine\4Projects\1C++\ArcadeGames\Intermediate\Build\Win64\UE4Editor\Development\ArcadeGames\UE4Editor-ArcadeGames-1823.suppressed.exp
1>PacmanGhostController.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl UNavigationSystemV1::K2_GetRandomReachablePointInRadius(class UObject *,struct FVector const &,struct FVector &,float,class ANavigationData *,class TSubclassOf)" (__imp_?K2_GetRandomReachablePointInRadius@UNavigationSystemV1@@SA_NPEAVUObject@@AEBUFVector@@AEAU3@MPEAVANavigationData@@anonymous_user_e71e0d8a?$TSubclassOf@VUNavigationQueryFilter@@@@@Z) referenced in function "public: void __cdecl APacmanGhostController::SearchNewPoint(void)" (?SearchNewPoint@APacmanGhostController@@QEAAXXZ)
1>PacmanGhostController.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class UNavigationSystemV1 * __cdecl UNavigationSystemV1::GetCurrent(class UWorld *)" (__imp_?GetCurrent@UNavigationSystemV1@@SAPEAV1@PEAVUWorld@@@Z) referenced in function "public: void __cdecl APacmanGhostController::SearchNewPoint(void)" (?SearchNewPoint@APacmanGhostController@@QEAAXXZ)
1>E:\FunStuff\Unreal Engine\4Projects\1C++\ArcadeGames\Binaries\Win64\UE4Editor-ArcadeGames-1823.dll : fatal error LNK1120: 2 unresolved externals
1>UnrealBuildTool : error : UBT ERROR: Failed to produce item: E:\FunStuff\Unreal Engine\4Projects\1C++\ArcadeGames\Binaries\Win64\UE4Editor-ArcadeGames-1823.dll
1>                        (see ../Programs/UnrealBuildTool/Log.txt for full exception trace)
1>Total build time: 89.64 seconds (Parallel executor: 0.00 seconds)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ""E:\FunStuff\Unreal Engine\5Engine\UE_4.20\Engine\Build\BatchFiles\Build.bat" ArcadeGamesEditor Win64 Development "E:\FunStuff\Unreal Engine\4Projects\1C++\ArcadeGames\ArcadeGames.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project "ArcadeGames.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

P.S. This is my first question, so if I should’ve included something else or left something out please tell me. Also, the reason I put all of the code in is because i’m relatively new to C++, so I’m not sure which part of the code created the error

Thanks for your time!

1 Like