Problem with creating a controller

I am following this tutorial, Unreal Engine 4 C++ Tutorial Version 4.0.2: Basic Artificial Intelligence - YouTube im sure many people are aware of it.

However i have found a strange issue when i create a controller, if i add a controller via the add code to project wizard and then try and build the project i get the following errors

1>------ Build started: Project: UnrealSpaceGame, Configuration: Development_Editor x64 ------
1>  Parsing headers for UnrealSpaceGameEditor
1>  Reflection code generation finished for UnrealSpaceGameEditor and took 2.187
1>  Performing 3 actions (max 4 parallel jobs)
1>  UnrealSpaceGame.generated.cpp
1>  MyAIControllerTest.cpp
1>  [3/3] link.exe UE4Editor-UnrealSpaceGame.dll
1>     Creating library D:\UnrealSpaceGame\Intermediate\Build\Win64\UnrealSpaceGameEditor\Development\UE4Editor-UnrealSpaceGame.lib and object D:\UnrealSpaceGame\Intermediate\Build\Win64\UnrealSpaceGameEditor\Development\UE4Editor-UnrealSpaceGame.exp
1>MyAIControllerTest.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl AAIController::AAIController(class FPostConstructInitializeProperties const &)" (__imp_??0AAIController@@QEAA@AEBVFPostConstructInitializeProperties@@@Z) referenced in function "public: __cdecl AMyAIControllerTest::AMyAIControllerTest(class FPostConstructInitializeProperties const &)" (??0AMyAIControllerTest@@QEAA@AEBVFPostConstructInitializeProperties@@@Z)
1>MyAIControllerTest.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl AAIController::~AAIController(void)" (__imp_??1AAIController@@UEAA@XZ) referenced in function "public: virtual __cdecl AMyAIControllerTest::~AMyAIControllerTest(void)" (??1AMyAIControllerTest@@UEAA@XZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl AAIController::~AAIController(void)" (__imp_??1AAIController@@UEAA@XZ)
1>MyAIControllerTest.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl AAIController::AAIController(class AAIController const &)" (__imp_??0AAIController@@QEAA@AEBV0@@Z) referenced in function "public: __cdecl AMyAIControllerTest::AMyAIControllerTest(class AMyAIControllerTest const &)" (??0AMyAIControllerTest@@QEAA@AEBV0@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl AAIController::AAIController(class AAIController const &)" (__imp_??0AAIController@@QEAA@AEBV0@@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::ClearFocus(unsigned char)" (?ClearFocus@AAIController@@UEAAXE@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::ClearFocus(unsigned char)" (?ClearFocus@AAIController@@UEAAXE@Z) referenced in function "class UFunction * __cdecl Z_Construct_UFunction_AUnrealSpaceGameProjectile_OnHit(void)" (?Z_Construct_UFunction_AUnrealSpaceGameProjectile_OnHit@@YAPEAVUFunction@@XZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::DisplayDebug(class UCanvas *,class FDebugDisplayInfo const &,float &,float &)" (?DisplayDebug@AAIController@@UEAAXPEAVUCanvas@@AEBVFDebugDisplayInfo@@AEAM2@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::DisplayDebug(class UCanvas *,class FDebugDisplayInfo const &,float &,float &)" (?DisplayDebug@AAIController@@UEAAXPEAVUCanvas@@AEBVFDebugDisplayInfo@@AEAM2@Z) referenced in function "class UFunction * __cdecl Z_Construct_UFunction_AUnrealSpaceGameProjectile_OnHit(void)" (?Z_Construct_UFunction_AUnrealSpaceGameProjectile_OnHit@@YAPEAVUFunction@@XZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FString __cdecl AAIController::GetDebugIcon(void)const " (?GetDebugIcon@AAIController@@UEBA?AVFString@@XZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual class FString __cdecl AAIController::GetDebugIcon(void)const " (?GetDebugIcon@AAIController@@UEBA?AVFString@@XZ) referenced in function "public: static void * __cdecl ANode::operator new(unsigned __int64,class UObject *,class FName,enum EObjectFlags)" (??2ANode@@SAPEAX_KPEAVUObject@@VFName@@W4EObjectFlags@@@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FVector __cdecl AAIController::GetFocalPoint(void)const " (?GetFocalPoint@AAIController@@UEBA?AVFVector@@XZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual class FVector __cdecl AAIController::GetFocalPoint(void)const " (?GetFocalPoint@AAIController@@UEBA?AVFVector@@XZ) referenced in function "void __cdecl `dynamic initializer for 'AutoInitializeAUnrealSpaceGameGameMode''(void)" (??__EAutoInitializeAUnrealSpaceGameGameMode@@YAXXZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::GetPlayerViewPoint(class FVector &,class FRotator &)const " (?GetPlayerViewPoint@AAIController@@UEBAXAEAVFVector@@AEAVFRotator@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::GetPlayerViewPoint(class FVector &,class FRotator &)const " (?GetPlayerViewPoint@AAIController@@UEBAXAEAVFVector@@AEAVFRotator@@@Z) referenced in function "void __cdecl GetPrivateStaticClassBody<class ANode>(wchar_t const *,wchar_t const *,class UClass * &,void (__cdecl*)(void))" (??$GetPrivateStaticClassBody@VANode@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::GrabDebugSnapshot(struct FVisLogEntry *)const " (?GrabDebugSnapshot@AAIController@@UEBAXPEAUFVisLogEntry@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::GrabDebugSnapshot(struct FVisLogEntry *)const " (?GrabDebugSnapshot@AAIController@@UEBAXPEAUFVisLogEntry@@@Z) referenced in function "class UClass * __cdecl Z_Construct_UClass_AEnemyCharacter(void)" (?Z_Construct_UClass_AEnemyCharacter@@YAPEAVUClass@@XZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::InitNavigationControl(class UNavigationComponent * &,class UPathFollowingComponent * &)" (?InitNavigationControl@AAIController@@UEAAXAEAPEAVUNavigationComponent@@AEAPEAVUPathFollowingComponent@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::InitNavigationControl(class UNavigationComponent * &,class UPathFollowingComponent * &)" (?InitNavigationControl@AAIController@@UEAAXAEAPEAVUNavigationComponent@@AEAPEAVUPathFollowingComponent@@@Z) referenced in function "void __cdecl GetPrivateStaticClassBody<class AUnrealSpaceGameCharacter>(wchar_t const *,wchar_t const *,class UClass * &,void (__cdecl*)(void))" (??$GetPrivateStaticClassBody@VAUnrealSpaceGameCharacter@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::LineOfSightTo(class AActor const *,class FVector,bool)const " (?LineOfSightTo@AAIController@@UEBA_NPEBVAActor@@VFVector@@_N@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual bool __cdecl AAIController::LineOfSightTo(class AActor const *,class FVector,bool)const " (?LineOfSightTo@AAIController@@UEBA_NPEBVAActor@@VFVector@@_N@Z) referenced in function "void __cdecl GetPrivateStaticClassBody<class AUnrealSpaceGameHUD>(wchar_t const *,wchar_t const *,class UClass * &,void (__cdecl*)(void))" (??$GetPrivateStaticClassBody@VAUnrealSpaceGameHUD@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::OnMoveCompleted(struct FAIRequestID,enum EPathFollowingResult::Type)" (?OnMoveCompleted@AAIController@@UEAAXUFAIRequestID@@W4Type@EPathFollowingResult@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::OnMoveCompleted(struct FAIRequestID,enum EPathFollowingResult::Type)" (?OnMoveCompleted@AAIController@@UEAAXUFAIRequestID@@W4Type@EPathFollowingResult@@@Z) referenced in function "void __cdecl GetPrivateStaticClassBody<class AUnrealSpaceGameProjectile>(wchar_t const *,wchar_t const *,class UClass * &,void (__cdecl*)(void))" (??$GetPrivateStaticClassBody@VAUnrealSpaceGameProjectile@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Possess(class APawn *)" (?Possess@AAIController@@UEAAXPEAVAPawn@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::Possess(class APawn *)" (?Possess@AAIController@@UEAAXPEAVAPawn@@@Z) referenced in function "class UClass * __cdecl Z_Construct_UClass_ANode(void)" (?Z_Construct_UClass_ANode@@YAPEAVUClass@@XZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::PostInitializeComponents(void)" (?PostInitializeComponents@AAIController@@UEAAXXZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::PostInitializeComponents(void)" (?PostInitializeComponents@AAIController@@UEAAXXZ) referenced in function "class UClass * __cdecl Z_Construct_UClass_ANode(void)" (?Z_Construct_UClass_ANode@@YAPEAVUClass@@XZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual struct FAIRequestID __cdecl AAIController::RequestMove(class TSharedPtr<struct FNavigationPath,1>,class AActor *,float,bool,class TSharedPtr<struct FMoveRequestCustomData,1>)" (?RequestMove@AAIController@@UEAA?AUFAIRequestID@@V?$TSharedPtr@UFNavigationPath@@$00@@PEAVAActor@@M_NV?$TSharedPtr@UFMoveRequestCustomData@@$00@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual struct FAIRequestID __cdecl AAIController::RequestMove(class TSharedPtr<struct FNavigationPath,1>,class AActor *,float,bool,class TSharedPtr<struct FMoveRequestCustomData,1>)" (?RequestMove@AAIController@@UEAA?AUFAIRequestID@@V?$TSharedPtr@UFNavigationPath@@$00@@PEAVAActor@@M_NV?$TSharedPtr@UFMoveRequestCustomData@@$00@@@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Reset(void)" (?Reset@AAIController@@UEAAXXZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Reset(void)" (?Reset@AAIController@@UEAAXXZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::RunBehaviorTree(class UBehaviorTree *)" (?RunBehaviorTree@AAIController@@UEAA_NPEAVUBehaviorTree@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::RunBehaviorTree(class UBehaviorTree *)" (?RunBehaviorTree@AAIController@@UEAA_NPEAVUBehaviorTree@@@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::SetFocalPoint(class FVector,bool,unsigned char)" (?SetFocalPoint@AAIController@@UEAAXVFVector@@_NE@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::SetFocalPoint(class FVector,bool,unsigned char)" (?SetFocalPoint@AAIController@@UEAAXVFVector@@_NE@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::SetFocus(class AActor *,unsigned char)" (?SetFocus@AAIController@@UEAAXPEAVAActor@@E@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::SetFocus(class AActor *,unsigned char)" (?SetFocus@AAIController@@UEAAXPEAVAActor@@E@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::StopMovement(void)" (?StopMovement@AAIController@@UEAAXXZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::StopMovement(void)" (?StopMovement@AAIController@@UEAAXXZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Tick(float)" (?Tick@AAIController@@UEAAXM@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Tick(float)" (?Tick@AAIController@@UEAAXM@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UnPossess(void)" (?UnPossess@AAIController@@UEAAXXZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UnPossess(void)" (?UnPossess@AAIController@@UEAAXXZ)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UpdateControlRotation(float,bool)" (?UpdateControlRotation@AAIController@@UEAAXM_N@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UpdateControlRotation(float,bool)" (?UpdateControlRotation@AAIController@@UEAAXM_N@Z)
1>MyAIControllerTest.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::UseBlackboard(class UBlackboardData *)" (?UseBlackboard@AAIController@@UEAA_NPEAVUBlackboardData@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::UseBlackboard(class UBlackboardData *)" (?UseBlackboard@AAIController@@UEAA_NPEAVUBlackboardData@@@Z)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_AAIController(void)" (__imp_?Z_Construct_UClass_AAIController@@YAPEAVUClass@@XZ) referenced in function "class UClass * __cdecl Z_Construct_UClass_AMyAIControllerTest(void)" (?Z_Construct_UClass_AMyAIControllerTest@@YAPEAVUClass@@XZ)
1>UnrealSpaceGame.generated.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class UClass * __cdecl AAIController::StaticClass(void)" (__imp_?StaticClass@AAIController@@SAPEAVUClass@@XZ) referenced in function "void __cdecl GetPrivateStaticClassBody<class AMyAIControllerTest>(wchar_t const *,wchar_t const *,class UClass * &,void (__cdecl*)(void))" (??$GetPrivateStaticClassBody@VAMyAIControllerTest@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)
1>D:\UnrealSpaceGame\Binaries\Win64\UE4Editor-UnrealSpaceGame.dll : fatal error LNK1120: 26 unresolved externals
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: D:\UnrealSpaceGame\Binaries\Win64\UE4Editor-UnrealSpaceGame.dll
1>  Cumulative action seconds (4 processors): 0.00 building projects, 1.42 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.10 linking, 0.00 other
1>  UBT execution time: 7.06 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Program Files\Unreal Engine\4.4\Engine\Build\BatchFiles\Build.bat" UnrealSpaceGameEditor Win64 Development "D:\UnrealSpaceGame\UnrealSpaceGame.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

------------------------------------------------------------------------------------------------------------------------------------

I was able to create a empty character the same way and build the project fine. I could add the new class into the game. however i seem to be having big problems with adding the controller and i had a simular problem with a BTTask class earlier.

Any suggestions? i am using version 4.4 and am using perforce with only content, source and config files- as well as the .uproject file on the server. Appreciate any clues at all, thanks!

An empty controller should work? i added in the code from the tutorial video, and i still return this error (adding includes to the blackboard components etc) . Please help! Very frustrating! i have working AI in blueprints, but want to make the base in C++ so i have more options!

It seems this is linked some how to error code 2, any ideas?

Hi ,

I apologize for the delayed response to your question. To resolve the error messages you are seeing, you would need to add "AIModule" to the public dependencies listed in the .build.cs file for your project. If you have not made any other changes to that line, it should look like this:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "AIModule" });
1 Like

worked a charm . everything going smooth now! thanks for your time.