Linker Errors when deriving off NavMeshBounds

I’m having a bit of trouble understanding why I can’t make a class that derives off of ANavMeshBoundsVolume. When I create the class, I get Linker errors which I wasn’t expecting and am not really sure about how to resolve. The errors are:

CompilerResultsLog:Error: Error MyNavMeshBoundsVolume.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANavMeshBoundsVolume::PostRegisterAllComponents(void)" (?PostRegisterAllComponents@ANavMeshBoundsVolume@@UEAAXXZ)

CompilerResultsLog:Error: Error TheRelic.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANavMeshBoundsVolume::PostRegisterAllComponents(void)" (?PostRegisterAllComponents@ANavMeshBoundsVolume@@UEAAXXZ)

CompilerResultsLog:Error: Error MyNavMeshBoundsVolume.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANavMeshBoundsVolume::PostUnregisterAllComponents(void)" (?PostUnregisterAllComponents@ANavMeshBoundsVolume@@UEAAXXZ)

CompilerResultsLog:Error: Error TheRelic.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANavMeshBoundsVolume::PostUnregisterAllComponents(void)" (?PostUnregisterAllComponents@ANavMeshBoundsVolume@@UEAAXXZ)

CompilerResultsLog:Error: Error MyNavMeshBoundsVolume.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANavMeshBoundsVolume::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@ANavMeshBoundsVolume@@UEAAXAEAUFPropertyChangedEvent@@@Z)

CompilerResultsLog:Error: Error TheRelic.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANavMeshBoundsVolume::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@ANavMeshBoundsVolume@@UEAAXAEAUFPropertyChangedEvent@@@Z)

The generated cpp is:

// Fill out your copyright notice in the Description page of Project Settings.

#include "TheRelic.h"
#include "MyNavMeshBoundsVolume.h"

The generated header file is

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "AI/Navigation/NavMeshBoundsVolume.h"
#include "MyNavMeshBoundsVolume.generated.h"

/**
 * 
 */
UCLASS()
class THERELIC_API AMyNavMeshBoundsVolume : public ANavMeshBoundsVolume
{
	GENERATED_BODY()
	
	
	
	
};

Any thoughts about why this is? I suspect there’s some macro or keyword I don’t know about.

Thanks,

Hi, I suspect you are missing a module from your Build.cs file. According to this link wiki you may have to add “AIModule” in the project dependencies.

If it’s not AIModule it’s probably another one but I’m almost sure you are just missing a dependency there.

Good luck !
Best regards.

I tried that and it still didn’t compile. It seemed that ANavMeshBoundsVolume was in the Core engine anyway, unless I’m misunderstood how the module system works.

Isn’t it because some pure virtual function defined in ANavMeshBoundsVolume are not implemented in your derived class ?

Try to add theses undefined function in your derived class, implement them by just calling the Super::XXX function and see if it works :slight_smile:

But ANavMeshBoundsVolume has a function definition.

`void ANavMeshBoundsVolume::PostRegisterAllComponents()
{
Super::PostRegisterAllComponents();

UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
if (NavSys && Role == ROLE_Authority)
{
	NavSys->OnNavigationBoundsAdded(this);
}

}

`

I didn’t think I had to define a definition if one already exists in the base class?

I agree with you, but try it anyway just in case it’s some of the Unreal magic again :D.

In your class, define the same function using the keyword “override” at the end. Then in your c++ code, implement the function like this:

void MYCLASS::PostRegisterAllComponents()
{
    Super::PostRegisterAllComponents();
}

and see if it fixes. If it doesn’t, that’s 100% a missing module in your build.cs (Just need to find which one :D)

Yeah I did that as well and still have the same linker error with the Super:: command. Is there a good way of finding which module is required? I seem to struggle to find any resources which indicates what class belongs to what module.

I’m pretty sure you missed something
Take a look at this tutorial again and let us know :slight_smile:

I’ve since found a work around for my original issue but will take another look in a while as I don’t like my workaround.

ANavMeshBoundsVolume is not fully exposed to the API. You’d need to change engine sources to say something like this:

UCLASS()
class ENGINE_API ANavMeshBoundsVolume : public AVolume

Cheers,

–mieszko

Oh wow that was bit out of my range haha :smiley: