Including Engine Header Error (Recast.h)

Hi together,

I want to process data from Recast in a Actor Subclass. In detail i want to process rcCompactHeightfield Data. So i tried to include Recast.h and it is found though my class won`t compile. How could i possibly circumvent this problem?

Actor Header:

#pragma once
#include "GameFramework/Actor.h"
#include "Runtime/Navmesh/Public/Recast/Recast.h"
#include "Runtime/Navmesh/Public/Recast/RecastAlloc.h"
#include "Runtime/Navmesh/Public/Recast/RecastAssert.h"
#include "MyProcessor.generated.h"

UCLASS()
class MYPROJECT_API AMyProcessor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMyProcessor();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
    
    virtual void PostLoad() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

    void Process(rcCompactHeightfield& RasterContext);
};

Actor cpp:

#include "MyProject.h"
#include "MyProcessor.h"

// Sets default values
AMyProcessor::AMyProcessor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void AMyProcessor::BeginPlay()
{
	Super::BeginPlay();
	UE_LOG(LogTemp, Warning, TEXT("MyProcessor spawned"));
}

void AMyProcessor::PostLoad()
{
    Super::PostLoad();
    UE_LOG(LogTemp, Warning, TEXT("MyProcessor loaded"));
}


// Called every frame
void AMyProcessor::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

void Process(rcCompactHeightfield& RasterContext)
{
    
}

Error:

Info /Users/leonardodapisa/Desktop/fork/UnrealEngine/Engine/Source/Runtime/Navmesh/Public/Recast/Recast.h:108:1: error: expected expression
Info public:
Info ^
Info /Users/leonardodapisa/Desktop/fork/UnrealEngine/Engine/Source/Runtime/Navmesh/Public/Recast/Recast.h:106:19: error: variable has incomplete type 'class NAVMESH_API'
Info class NAVMESH_API rcContext
Info           ^

Obviously he has problem with the “NAVMESH_API” and so do i since i don`t understand at the moment where it is coming from.

Thanks in advance,

Hello,

I am sorry to hear about your problem.

Please note that usage of some Unreal Engine 4 classes requires extra modules that may not be added to your project by default.

In this situation, it is most likely that the problem occurs because “Navmesh” module is not included.
Thus, please open Build.cs file of your game (ProjectName/Source/ProjectName/ProjectName.Build.cs) and add Navmesh to the list of included modules:

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

In general, when you are going to use a class in your project for the first time, it is a good practise to check what module is class implemented in, and see if it is included in your project. To find a module, please go to class declaration (header file) or use online documentation (https://docs.unrealengine.com). At the bottom of the page, there is a “References” section, where you can obtain information about headers and modules that should be used:

Hope this helped!
Have a great day!

Thanks a lot. This was indeed the problem. I thought it should be in cause the top-down example includes a NavMesh. But i overlooked that the project and the engine are in fact two builds.