IModuleInterface Not Found First Time

When I run a build, the first build after a clean fails every time, but a second build makes it succeed. Clearly I messed up a dependency or something somewhere. I have the plugin from GitHub - gaslightgames/UE4_EOS_Plugin: A plugin and sample project, built for Unreal Engine 4, that implements the Epic Online Services SDK enabled and I have shamelessly stolen the Action RPG loading screen module and successfully botched it to make it sort of compile. What do I need to tinker with to make it succeed?

First build:

1>Creating makefile for TDGameEditor (no existing makefile)
1>Parsing headers for TDGameEditor
1>  Running UnrealHeaderTool "E:\UnrealEngine\Projects\TDGame3\TDGame.uproject" "E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\TDGameEditor\Development\TDGameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\...\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed
1>Reflection code generated for TDGameEditor in 6.0156302 seconds
1>Building TDGameEditor...
1>Using Visual Studio 2017 14.16.27034 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>[Upgrade]
1>[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
1>[Upgrade]     bLegacyPublicIncludePaths = false                 => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
1>[Upgrade]     ShadowVariableWarningLevel = WarningLevel.Error   => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
1>[Upgrade]     PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs   => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
1>[Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in TDGameEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.
1>[Upgrade]
1>Building 21 actions with 16 processes...
1>  [1/21] Default.rc2
1>  [2/21] Default.rc2
1>  [3/21] Default.rc2
1>  [4/21] SharedPCH.Engine.NonOptimized.cpp
1>  [5/21] SharedPCH.Engine.cpp
1>  [6/21] TDGameLoadingScreen.cpp
1>E:\UnrealEngine\Projects\TDGame3\Source\TDGameLoadingScreen\Public\TDGameLoadingScreen.h(5): fatal error C1083: Cannot open include file: 'ModuleInterface.h': No such file or directory
1>  [7/21] TDGame.cpp
1>  [8/21] TDGame.init.gen.cpp
1>  [9/21] TDGameGameModeBase.cpp
1>  [10/21] Module.OnlineSubsystemEOS.gen.cpp
1>  [11/21] TDGameGameModeBase.gen.cpp
1>  [12/21] TDGameGameInstance.gen.cpp
1>  [13/21] Module.OnlineSubsystemEOS.cpp
1>  [14/21] UE4Editor-OnlineSubsystemEOS.lib
1>     Creating library E:\UnrealEngine\Projects\TDGame3\Plugins\OnlineSubsystemEOS\Intermediate\Build\Win64\UE4Editor\Development\OnlineSubsystemEOS\UE4Editor-OnlineSubsystemEOS.lib and object E:\UnrealEngine\Projects\TDGame3\Plugins\OnlineSubsystemEOS\Intermediate\Build\Win64\UE4Editor\Development\OnlineSubsystemEOS\UE4Editor-OnlineSubsystemEOS.exp
1>  [15/21] TDGameGameInstance.cpp
1>  [16/21] UE4Editor-TDGame.lib
1>     Creating library E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGame\UE4Editor-TDGame.lib and object E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGame\UE4Editor-TDGame.exp
1>  [17/21] UE4Editor-OnlineSubsystemEOS.dll
1>     Creating library E:\UnrealEngine\Projects\TDGame3\Plugins\OnlineSubsystemEOS\Intermediate\Build\Win64\UE4Editor\Development\OnlineSubsystemEOS\UE4Editor-OnlineSubsystemEOS.suppressed.lib and object E:\UnrealEngine\Projects\TDGame3\Plugins\OnlineSubsystemEOS\Intermediate\Build\Win64\UE4Editor\Development\OnlineSubsystemEOS\UE4Editor-OnlineSubsystemEOS.suppressed.exp
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "E:\UnrealEngine\UE_4.25\Engine\Build\BatchFiles\Build.bat TDGameEditor Win64 Development -Project="E:\UnrealEngine\Projects\TDGame3\TDGame.uproject" -WaitMutex -FromMsBuild" exited with code 6.
1>Done building project "TDGame.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

Second build:

1>------ Build started: Project: TDGame, Configuration: Development_Editor x64 ------
2>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>Project not selected to build for this solution configuration 
1>Building TDGameEditor...
1>Using Visual Studio 2017 14.16.27034 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>[Upgrade]
1>[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
1>[Upgrade]     bLegacyPublicIncludePaths = false                 => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
1>[Upgrade]     ShadowVariableWarningLevel = WarningLevel.Error   => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
1>[Upgrade]     PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs   => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
1>[Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in TDGameEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.
1>[Upgrade]
1>Building 5 actions with 16 processes...
1>  [1/5] TDGameLoadingScreen.cpp
1>  [2/5] UE4Editor-TDGameLoadingScreen.lib
1>     Creating library E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGameLoadingScreen\UE4Editor-TDGameLoadingScreen.lib and object E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGameLoadingScreen\UE4Editor-TDGameLoadingScreen.exp
1>  [3/5] UE4Editor-TDGameLoadingScreen.dll
1>     Creating library E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGameLoadingScreen\UE4Editor-TDGameLoadingScreen.suppressed.lib and object E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGameLoadingScreen\UE4Editor-TDGameLoadingScreen.suppressed.exp
1>  [4/5] UE4Editor-TDGame.dll
1>     Creating library E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGame\UE4Editor-TDGame.suppressed.lib and object E:\UnrealEngine\Projects\TDGame3\Intermediate\Build\Win64\UE4Editor\Development\TDGame\UE4Editor-TDGame.suppressed.exp
1>  [5/5] TDGameEditor.target
1>Total time in Parallel executor: 7.89 seconds
1>Total execution time: 8.38 seconds
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 1 skipped ==========

Turns out I was missing the module from TDGame.Build.cs.

PrivateDependencyModuleNames.AddRange(new string[] {
            ...
            "TDGameLoadingScreen",
            ....
}
1 Like

Btw. I also had this issue (reusing the ActionRPG loading screen).
I had to change something:

I changed the include for the ModuleInterface to:

#include "Modules/ModuleInterface.h"
#include "Modules/ModuleManager.h"

And I changed a Slate include for SThrobber to:

#include "Widgets/Images/SThrobber.h"

And I call the Loading Screen in the GameInstance by creating two methods:

void UTelekinesisGameInstance::PlayLoadingScreen(bool bPlayUntilStopped, float PlayTime)
{
	IActionRPGLoadingScreenModule& LoadingScreenModule = IActionRPGLoadingScreenModule::Get();
	LoadingScreenModule.StartInGameLoadingScreen(bPlayUntilStopped, PlayTime);
}

void UTelekinesisGameInstance::StopLoadingScreen()
{
	IActionRPGLoadingScreenModule& LoadingScreenModule = IActionRPGLoadingScreenModule::Get();
	LoadingScreenModule.StopInGameLoadingScreen();
}