NavModifierComponent linker error

in DoorActor.h

UPROPERTY(EditAnywhere, BlueprintReadOnly)
		class ANavModifierVolume* NavModifier;

in DoorActor.cpp

#include "AI/Navigation/NavModifierVolume.h"
#include "AI/Navigation/NavAreas/NavArea_Default.h"

...
void ADoorActor::OpenDoor()
{
    if(NavModifier != nullptr)
	    NavModifier->SetAreaClass(UNavArea_Default::StaticClass());
}

compiler error:

Error	LNK2019	unresolved external symbol "public: void __cdecl ANavModifierVolume::SetAreaClass(class TSubclassOf<class UNavArea>)" (?SetAreaClass@ANavModifierVolume@@QEAAXV?$TSubclassOf@VUNavArea@@@@@Z) referenced in function "public: void __cdecl ADoorActor::OpenDoor(void)" (?OpenDoor@ADoorActor@@QEAAXXZ)	NavTest	D:\My Documents\Unreal\NavTest\Intermediate\ProjectFiles\DoorActor.cpp.obj	1	Build		

Is there a module I should include in the build file? NavModifierVolume appears to be in Engine; I’ve added that to PrivateDependencyModuleNames, with no success (Engine is already in Public by default).

I’m aware I can do what I’m trying to do with blueprint; I’m looking for C++ solution.

See if changing:

UCLASS(MinimalAPI, hidecategories=(Navigation))
class ANavModifierVolume : public AVolume, public INavRelevantInterface

to

UCLASS(hidecategories=(Navigation))
class ENGINE_API ANavModifierVolume : public AVolume, public INavRelevantInterface

in NavModifierVolume.h helps. If so I’ll make the change in the engine.

Cheers,

–mieszko

Got these errors.

1>D:\Program Files\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\AI/Navigation/NavModifierVolume.h(16): error C2487: 'GetPrivateStaticClass': member of dll interface class may not be declared with dll interface
1>D:\Program Files\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\AI/Navigation/NavModifierVolume.h(16): error C2487: 'ANavModifierVolume::{ctor}': member of dll interface class may not be declared with dll interface

I’m assuming modifying the source code in Program Files and building the project as normal is the correct process. The fact that I got new error messages seems to support this assumption.

For this change to work you need to rebuild the engine (from the sources you can get from the github). I’ve just checked, making this change addresses linker error resulting from using NavModifierVolume in a game project. I’ll submit the change, but you’ll have to wait until 4.16 for it… or get it from github! :smiley: