Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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"
 class MYGAME_API AMyGameMode : public AGameMode
     virtual void BeginPlay() override;
     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.


Product Version: UE 4.13
more ▼

asked Sep 30 '16 at 12:03 AM in C++ Programming

avatar image

427 15 32 164

avatar image Acrossfy Sep 30 '16 at 12:01 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Sep 30 '16 at 02:00 PM

avatar image

427 15 32 164

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Feb 08 '19 at 10:14 AM

avatar image

219 4 13 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question