# How to get Unreal find headers needed for my code to work?

I am trying to open a dialog to select files under UE4, using OpenFileDialog.

I added this to my build.cs

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


#include "IDesktopPlatform.h"
#include <Developer\DesktopPlatform\Private\Windows\DesktopPlatformWindows.h>


Second line suggested by IntelliSense...

void AFileDialogOpenerActor::OpenFileDialog() {
FString defaultFile = "";
FString fileTypes = "";
TArray<FString> outFileNames;
uint32 flags = 1;
FDesktopPlatformWindows fpl;
fpl.OpenFileDialog(0, dialogName,defaultPath, defaultFile, fileTypes,flags, outFileNames);
}


When I try to compile, I get these linker error messages:

If I replace the above includes in the header to these:

#include "IDesktopPlatform.h"
#include "DesktopPlatformWindows.h"


In message log:

cannot open include file: "DesktopPlatformWindows.h" no such file or directory


If I play around with these includes, I get a mixture of these messages.(Either a linking error, either no such file, or the bunch of linking error messages) I took a look at containing folders of the headers and they are indeed there and public.

After some searching I found this:

I my header I changed the includes to this:

#include "DesktopPlatform/Public/IDesktopPlatform.h"
#include "DesktopPlatform/Public/DesktopPlatformModule.h"


In the cpp:

IDesktopPlatform* fpl = FDesktopPlatformModule::Get();
fpl->OpenFileDialog(0, dialogName, defaultPath, defaultFile, fileTypes, flags, outFileNames);


It looks like, I only needed a path to that header...

• Note that answers to questions aren't the proper place for follow-up questions. For on-topic follow up questions, you should consider posting a new question. Jul 3 '20 at 9:42