Compile error with IPlatformFile::FDirectoryVisitor* in method signature

Hello guys,

I’m trying to make method for binding with FCoreDelegates::OnMountPak delegate. If I’m binding this delegate with lambda in .cpp everything is ok, but when I’m trying to declare a function with the same signature (as lamda) in header I have compile error:

#pragma once

#include "GameFramework/GameMode.h"
#include "GenericPlatformFile.h"
#include "MyGameMode.generated.h"

UCLASS()
class MYGAME_API AMyGameMode : public AGameMode
{
	GENERATED_BODY()

public:

	AMyGameMode();

	virtual void BeginPlay() override;

	UFUNCTION()
	bool HandleMountPakDelegate(const FString& PakFilePath, uint32 PakOrder, IPlatformFile::FDirectoryVisitor* Visitor);
	//compile error:  Cannot find class 'PlatformFile', to resolve delegate 'FDirectoryVisitor'

}

It’s very strange because IPlatformFile is declared in “GenericPlatformFile.h” but it’s included… Please help me to resolve this frustrating issue.

Thanks!

Just to be clear: I tried a lot of ways to resolve this issue - using full path to header, forward declarations of IPlatfromFile or FPlatformFile and so on. But it doesn’t work. Before suggest an answer try to compile code above with your expected solution.

I found a workaround. So because I didn’t find a way how to include nested class, I made pure C++ class derived from FPakPlatformFile which is derived from IPakPlatform, so I was able to declare a method with required signature with nested class type in arguments for binding to delegate. So now this class is doing all routine work.

Use BindUObject instead of BindUFunction, don’t add UFUNCTION() to it, and it’s fine.