[Help] Questions when I construct my own Console-App in my project-folder.

Here is my work’s folder architecture:

-    [UnrealEngine_NF]
-          [Engine]
-          [Samples]
-          [Templates]
-          ....blablabla....
-    [UnrealProjects]
-          [ProjectFeudal]
-                [Content]
-                [Source]
-                    [Programs]
-                              [FeudalConsole]
-                                    [Private]
-                                          FeudalConsole.cpp
-                                          FeudalConsole.h
-                                    FeudalConsole.Target.cs
-                    ProjectFeudal.Target.cs
-                ProjectFeudal.uproject

Where FeudalConsole is copy from Engine’s Program/BlankProgram. But I changed it’s Target name and Module name.

Here is the compile error ( VS 2013 Communicate )

1>------ Build started: Project: FeudalConsole, Configuration: Development_Program x64 ------
1>Z:\UnrealProjects\ProjectFeudal\Source\Programs\FeudalConsole\Private\FeudalConsole.cpp(6): fatal error C1083: Cannot open include file: 'RequiredProgramMainCPPInclude.h': No such file or directory

I found the file is in “Z:\UnrealEngine_NF\Engine\Source\Runtime\Launch\Public\RequiredProgramMainCPPInclude.h”.
But my Module Rule has already locate this location… by relative path …

public class FeudalConsole : ModuleRules
  public FeudalConsole(TargetInfo Target)
        PrivateIncludePaths.Add("Runtime/Launch/Private");  // For LaunchEngineLoop.cpp include

So I try to use absolutely path here:

public class FeudalConsole : ModuleRules
  public FeudalConsole(TargetInfo Target)
        string MyUnrealPath = "Z:/UnrealEngine_NF/Engine/Source/";
        PublicIncludePaths.Add(MyUnrealPath + "Runtime/Launch/Public");
        PrivateIncludePaths.Add(MyUnrealPath + "Runtime/Launch/Private");  // For LaunchEngineLoop.cpp include

Then the project was successfully compiled. And generate FeudalConsole.exe in my project’s Binaries/Win64 ( “Z:\UnrealProjects\ProjectFeudal\Binaries\Win64” )

But If I run this .exe it will have some runtime error:
“Failed to determine engine directory: Defaulting to …/…/Engine”
I copy it to Z:\UnrealEngine_NF\Engine\Binaries\Win64
Then everything is ok… It runs successfully.

So there are two questions:
1, I don’t want to write absolute pathes in this Module Rule. If do so, I cannot work with my partners. (They may not place their work-folder in Z:)
2, I found the FeudalConsole.vcxproj’s OutputPath is “<NMakeOutput>Z:\UnrealEngine_NF\Engine\Binaries\Win64\FeudalConsole.exe</NMakeOutput>”,
but it generate FeudalConsole.exe in “Z:\UnrealProjects\ProjectFeudal\Binaries\Win64\FeudalConsole.exe” ? Why?

Thanks. :slight_smile:

I am curious about the same thing. I just ended up using absolute paths.

Maybe I need to try to debug the UBT to see how to fix this problem.


I think you need to change:




since the source file including “RequiredProgramMainCPPInclude.h” is in a Private sub-folder.
At least that is what I had to do.
Would be great if someone from Epic can comment on this?

The following blog post has an excellent description of the what and why:

Hope this works for you :wink:

Turns out I am running into exactly the same problem now.

I probably thought I was compiling successfully when I wasn’t: Sometimes Visual Studio reports that it is building your target (e.g. console app) but no built binary appears.

However, this build/folder layout as used by OP seems to be the only way to get a console application built side-by-side with user game modules and to get it built outside of the UnrealEngine source tree?

Still learning how to use UBT and its configuration properly it seems.