Custom Nav Area to make AI jump LNK2019 error

Hello Everyone!

So I’ve been trying to implement a nav area so my AI can jump within a level with this tutorial : A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums1-_Making_AI_Jump_as_a_Part_of_Path_Following

I’ve followed all the steps as best i could but i end up with this error:

BanditCharacter.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl ABanditController::ABanditController(void)" (??0ABanditController@@QEAA@XZ) referenced in function "public: static void __cdecl ABanditController::__DefaultConstructor(class FObjectInitializer const &)" (?__DefaultConstructor@ABanditController@@SAXAEBVFObjectInitializer@@@Z)

I’ve also added the “AI Module” in the Build.cs within the project but still getting this error. I’ve also referenced from the updated API project on github but not having any luck finding out whats wrong with this code.

Here are the scripts for my controller.
.h

#pragma once

#include "AIController.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BanditController.generated.h"

/**
 * 
 */
UCLASS()
class MAX_API ABanditController : public AAIController
{
	GENERATED_BODY()
	
public:
	ABanditController(const FObjectInitializer& ObjectInitializer);
	virtual void Possess(APawn* Pawn)override;

protected:
	UPROPERTY(VisibleAnywhere)
	UBehaviorTreeComponent* BehaviorTreeComp;

	UPROPERTY(VisibleAnywhere)
	UBlackboardComponent* BlackboardComp;
	
};

.cpp

#include "Max.h"
#include "BanditCharacter.h"
#include "Navigation/JumpPathComponent.h"
#include "BanditController.h"

ABanditController::ABanditController(const FObjectInitializer& ObjectInitializer)
	:Super(ObjectInitializer.SetDefaultSubobjectClass<UJumpPathComponent>(TEXT("PathFollowingComponent")))
{
	BehaviorTreeComp = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("BehaviorTreeComp"));
	BlackboardComp = CreateDefaultSubobject<UBlackboardComponent>(TEXT("BlackboardComp"));

}

void ABanditController::Possess(APawn* Pawn)
{
	Super::Possess(Pawn);

	ABanditCharacter* Bandit = Cast<ABanditCharacter>(Pawn);

	if (Bandit&&Bandit->BehaviorTree)
	{
		BlackboardComp->InitializeBlackboard(*Bandit->BehaviorTree->BlackboardAsset);
		BehaviorTreeComp->StartTree(*Bandit->BehaviorTree);
	}
}

I would really appreciate any help at all for this thank you for your time !

Hello,

I was able to resolve your compile issue by changing this code:

:Super(ObjectInitializer.SetDefaultSubobjectClass<UJumpPathComponent>(TEXT("PathFollowingComponent")))

to this:

:Super(ObjectInitializer)

Instead of Using SetDefaultSubobjectClass in the super, you can try to do so in the constructor itself. After I did this, I did not receive any more compiler errors. Let me know if this fixes your issue as well.

Have a great day

Hello Sean,

Sadly this didn’t for me on my end, I’m still getting the same error. I’m attaching the whole output the VS is giving me (sorry i didnt do this before) hopefully this can give more insight of what could be the problem.

1>------ Build started: Project: Max, Configuration: Development_Editor x64 ------
1>  Creating makefile for MaxEditor (no existing makefile)
1>  Performing 1 actions (4 in parallel)
1>  [1/1] Link UE4Editor-Max.dll
1>     Creating library E:\School\Project Arete\Unreal\Max\Max\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-Max.lib and object E:\School\Project Arete\Unreal\Max\Max\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-Max.exp
1>BanditCharacter.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl ABanditController::ABanditController(void)" (??0ABanditController@@QEAA@XZ) referenced in function "public: static void __cdecl ABanditController::__DefaultConstructor(class FObjectInitializer const &)" (?__DefaultConstructor@ABanditController@@SAXAEBVFObjectInitializer@@@Z)
1>E:\School\Project Arete\Unreal\Max\Max\Binaries\Win64\UE4Editor-Max.dll : fatal error LNK1120: 1 unresolved externals
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: E:\School\Project Arete\Unreal\Max\Max\Binaries\Win64\UE4Editor-Max.dll
1>  Total build time: 31.20 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3073: The command ""C:\Program Files\Epic Games\4.10\Engine\Build\BatchFiles\Build.bat" MaxEditor Win64 Development "E:\School\Project Arete\Unreal\Max\Max\Max.uproject" -rocket -waitmutex" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Thanks for a speedy response as well I really appreciate it.

So I’ve got it fixed but i really dont understand what i did to get it fixed.
I added what I’ve done to the tutorial project to see if it would get the same error i got and the tutorial project didnt.
So i compared the two going file after file until i came across MyProject.h and MyProject.cpp and noticed this line was added on both that I didn’t have:

MyProject.h

#pragma once

#ifndef __MAX_H__
#define __Max_H__

#include "Engine.h"

DECLARE_LOG_CATEGORY_EXTERN(LogMax, Log, All);  //***This is what was added

#endif

MyProject.cpp

#include "Max.h"

IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, Max, "Max" );

DEFINE_LOG_CATEGORY(LogMax) //****This is what was added

I really don’t understand how this fixed it though and if someone could explain to me why this works I would really appreciate it. I’m still learning C++ and programming in general and i would find this experience NULL if i didnt learn anything from it.

Also thanks again Sean Flint for taking the time to help me i do appreciate it!