Download

Extending from AIController giving errors.

HI, I have extended a class from AIController and getting a lot of errors just from extending.

.h


#pragma once

#include "AIController.h"
#include "MyAIController.generated.h"

/**
 * 
 */
UCLASS()
class AITEST_API AMyAIController : public AAIController
{
	GENERATED_UCLASS_BODY()

	
	
};

.cpp


#include "AITest.h"
#include "MyAIController.h"


AMyAIController::AMyAIController(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{

}

Errors



1>  [1/2] link.exe UE4Editor-AITest.dll
1>  [2/2] link.exe UE4Editor-HTML5TargetPlatform.dll
1>     Creating library D:\Unreal Engine\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-HTML5TargetPlatform.lib and object D:\Unreal Engine\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-HTML5TargetPlatform.exp
1>     Creating library C:\Users\Srikant\Documents\Unreal Projects\AITest\Intermediate\Build\Win64\AITestEditor\Development\UE4Editor-AITest.lib and object C:\Users\Srikant\Documents\Unreal Projects\AITest\Intermediate\Build\Win64\AITestEditor\Development\UE4Editor-AITest.exp
1>MyAIController.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 AMyAIController::AMyAIController(class FPostConstructInitializeProperties const &)" (??0AMyAIController@@QEAA@AEBVFPostConstructInitializeProperties@@@Z)
1>MyAIController.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 AMyAIController::~AMyAIController(void)" (??1AMyAIController@@UEAA@XZ)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl AAIController::~AAIController(void)" (__imp_??1AAIController@@UEAA@XZ)
1>MyAIController.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 AMyAIController::AMyAIController(class AMyAIController const &)" (??0AMyAIController@@QEAA@AEBV0@@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl AAIController::AAIController(class AAIController const &)" (__imp_??0AAIController@@QEAA@AEBV0@@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::ClearFocus(unsigned char)" (?ClearFocus@AAIController@@UEAAXE@Z)
1>AITest.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl AAIController::ClearFocus(unsigned char)" (?ClearFocus@AAIController@@UEAAXE@Z) referenced in function "public: static void * __cdecl AMyAIController::operator new(unsigned __int64,class UObject *,class FName,enum EObjectFlags)" (??2AMyAIController@@SAPEAX_KPEAVUObject@@VFName@@W4EObjectFlags@@@Z)
1>MyAIController.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>AITest.generated.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>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FString __cdecl AAIController::GetDebugIcon(void)const " (?GetDebugIcon@AAIController@@UEBA?AVFString@@XZ)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FString __cdecl AAIController::GetDebugIcon(void)const " (?GetDebugIcon@AAIController@@UEBA?AVFString@@XZ)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FVector __cdecl AAIController::GetFocalPoint(void)const " (?GetFocalPoint@AAIController@@UEBA?AVFVector@@XZ)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FVector __cdecl AAIController::GetFocalPoint(void)const " (?GetFocalPoint@AAIController@@UEBA?AVFVector@@XZ)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::GetPlayerViewPoint(class FVector &,class FRotator &)const " (?GetPlayerViewPoint@AAIController@@UEBAXAEAVFVector@@AEAVFRotator@@@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::GetPlayerViewPoint(class FVector &,class FRotator &)const " (?GetPlayerViewPoint@AAIController@@UEBAXAEAVFVector@@AEAVFRotator@@@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::GrabDebugSnapshot(struct FVisLogEntry *)const " (?GrabDebugSnapshot@AAIController@@UEBAXPEAUFVisLogEntry@@@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::GrabDebugSnapshot(struct FVisLogEntry *)const " (?GrabDebugSnapshot@AAIController@@UEBAXPEAUFVisLogEntry@@@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::InitNavigationControl(class UNavigationComponent * &,class UPathFollowingComponent * &)" (?InitNavigationControl@AAIController@@UEAAXAEAPEAVUNavigationComponent@@AEAPEAVUPathFollowingComponent@@@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::InitNavigationControl(class UNavigationComponent * &,class UPathFollowingComponent * &)" (?InitNavigationControl@AAIController@@UEAAXAEAPEAVUNavigationComponent@@AEAPEAVUPathFollowingComponent@@@Z)
1>MyAIController.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>AITest.generated.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>MyAIController.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>AITest.generated.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>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Possess(class APawn *)" (?Possess@AAIController@@UEAAXPEAVAPawn@@@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Possess(class APawn *)" (?Possess@AAIController@@UEAAXPEAVAPawn@@@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::PostInitializeComponents(void)" (?PostInitializeComponents@AAIController@@UEAAXXZ)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::PostInitializeComponents(void)" (?PostInitializeComponents@AAIController@@UEAAXXZ)
1>MyAIController.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>AITest.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>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Reset(void)" (?Reset@AAIController@@UEAAXXZ)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Reset(void)" (?Reset@AAIController@@UEAAXXZ)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::RunBehaviorTree(class UBehaviorTree *)" (?RunBehaviorTree@AAIController@@UEAA_NPEAVUBehaviorTree@@@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::RunBehaviorTree(class UBehaviorTree *)" (?RunBehaviorTree@AAIController@@UEAA_NPEAVUBehaviorTree@@@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::SetFocalPoint(class FVector,bool,unsigned char)" (?SetFocalPoint@AAIController@@UEAAXVFVector@@_NE@Z)
1>AITest.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>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::SetFocus(class AActor *,unsigned char)" (?SetFocus@AAIController@@UEAAXPEAVAActor@@E@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::SetFocus(class AActor *,unsigned char)" (?SetFocus@AAIController@@UEAAXPEAVAActor@@E@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::StopMovement(void)" (?StopMovement@AAIController@@UEAAXXZ)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::StopMovement(void)" (?StopMovement@AAIController@@UEAAXXZ)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Tick(float)" (?Tick@AAIController@@UEAAXM@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::Tick(float)" (?Tick@AAIController@@UEAAXM@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UnPossess(void)" (?UnPossess@AAIController@@UEAAXXZ)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UnPossess(void)" (?UnPossess@AAIController@@UEAAXXZ)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UpdateControlRotation(float,bool)" (?UpdateControlRotation@AAIController@@UEAAXM_N@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AAIController::UpdateControlRotation(float,bool)" (?UpdateControlRotation@AAIController@@UEAAXM_N@Z)
1>MyAIController.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::UseBlackboard(class UBlackboardData *)" (?UseBlackboard@AAIController@@UEAA_NPEAVUBlackboardData@@@Z)
1>AITest.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl AAIController::UseBlackboard(class UBlackboardData *)" (?UseBlackboard@AAIController@@UEAA_NPEAVUBlackboardData@@@Z)
1>AITest.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_AMyAIController(void)" (?Z_Construct_UClass_AMyAIController@@YAPEAVUClass@@XZ)
1>AITest.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 AMyAIController>(wchar_t const *,wchar_t const *,class UClass * &,void (__cdecl*)(void))" (??$GetPrivateStaticClassBody@VAMyAIController@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)
1>C:\Users\Srikant\Documents\Unreal Projects\AITest\Binaries\Win64\UE4Editor-AITest.dll : fatal error LNK1120: 26 unresolved externals
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: C:\Users\Srikant\Documents\Unreal Projects\AITest\Binaries\Win64\UE4Editor-AITest.dll
1>  Cumulative action seconds (4 processors): 0.00 building projects, 0.00 compiling, 0.00 creating app bundles, 0.00 generating debug info, 1.14 linking, 0.00 other
1>  UBT execution time: 19.99 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""D:\Unreal Engine\Engine\Build\BatchFiles\Build.bat" AITestEditor Win64 Development "C:\Users\Srikant\Documents\Unreal Projects\AITest\AITest.uproject"" exited with code -1.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

You likely need to add AIModule to your PublicDependencyModuleNames in your project’s Build.cs file.

Solved the problem…

You can also just delete the AITEST_API thing from the class declaration, that worked fine for me.

Thank you!

Really bad necro…

But seeing the post date, it has been a long time since I started with UE4… :slight_smile: