[Help] Unreal Engine 4 showing "failed to automatically hot reload the module"

This error is showing whenever creating any C++ classes(C++ Actor or other objects) in any projects

This error won’t shows If I create the C++ Class in the default path “ProjectName\Source\ProjectName”

It only shows when I try to create the C++ Class Inside any sub-folder of that Default Path like “ProjectName\Source\ProjectName\SubFolder”

Everything was working fine but then I tried to update to VS2022 after uninstalling VS2019
but VS2022 didn’t installed so I Installed back VS2019 again and then this error started showing.
I re-installed both Unreal Engine 4 and VS2019 but the error is still there
By the way I’m using UE4.27.1 because my pc can’t run UE5.

Here is the Unreal’s Output Log

And Here is the text version of that Output Log after creating the Class

LogEditorClassViewer: Warning: Class /Engine/Tutorial/InWorldBlueprintEditing/TutorialAssets/IWBE_Blutility.IWBE_Blutility_C has parent /Script/Blutility.PlacedEditorUtilityBase, but this parent is not found. The Class will not be shown in ClassViewer.
LogSlate: Took 0.000315 seconds to synchronously load lazily loaded font ‘…/…/…/Engine/Content/Slate/Fonts/Roboto-BoldCondensed.ttf’ (158K)
Running D:/Installed Software/Epic Games/UE_4.27/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project=“E:/Documents/3D/Unreal Engine Project/TestProject/TestProject.uproject” -game -rocket -progress
Discovering modules, targets and source code for project…
Binding IntelliSense data…
Binding IntelliSense data… 100%
Writing project files…
Writing project files… 67%
Writing project files… 100%
Candidate modules for hot reload:
TestProject
Launching UnrealBuildTool… [D:/Installed Software/Epic Games/UE_4.27/Engine/Binaries/DotNET/UnrealBuildTool.exe -ModuleWithSuffix=TestProject,7875 TestProjectEditor Win64 Development -Project=“E:/Documents/3D/Unreal Engine Project/TestProject/TestProject.uproject” “E:/Documents/3D/Unreal Engine Project/TestProject/TestProject.uproject” -IgnoreJunk]
CompilerResultsLog: New page: Compilation - Oct 20, 2023, 7:15:20 PM
CompilerResultsLog: Creating makefile for TestProjectEditor (no existing makefile)
CompilerResultsLog: Parsing headers for TestProjectEditor
CompilerResultsLog: Running UnrealHeaderTool “E:\Documents\3D\Unreal Engine Project\TestProject\TestProject.uproject” “E:\Documents\3D\Unreal Engine Project\TestProject\Intermediate\Build\Win64\TestProjectEditor\Development\TestProjectEditor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -abslog=“C
:\Users\sksaf\AppData\Local\UnrealBuildTool\Log_UHT.txt” -installed
CompilerResultsLog: LogInit: Display: Loading text-based GConfig…
CompilerResultsLog: Reflection code generated for TestProjectEditor in 30.1579494 seconds
CompilerResultsLog: Building TestProjectEditor…
CompilerResultsLog: Using Visual Studio 2019 14.29.30152 toolchain (D:\Installed Software\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
CompilerResultsLog: Building 5 actions with 8 processes…
CompilerResultsLog: [1/5] TestActor.cpp
CompilerResultsLog: E:\Documents\3D\Unreal Engine Project\TestProject\Source\TestProject\Folder\TestActor.cpp(4): fatal error C1083: Cannot open include file: ‘Folder/TestActor.h’: No such file or directory
CompilerResultsLog: [2/5] TestActor.gen.cpp
LogMainFrame: MainFrame: Module compiling took 71.330 seconds
Warning: HotReload failed, recompile failed
Warning: RebindPackages failed because compilation failed.
LogSlate: Window ‘Message’ being destroyed
Message dialog closed, result: Yes, title: Message, text: Successfully added class ‘TestActor’, however you must recompile the ‘TestProject’ module before it will appear in the Content Browser. Failed to automatically hot reload the ‘TestProject’ module.
Would you like to open the Output Log to see more details?
LogSlate: Window ‘Add C++ Class’ being destroyed

And I tried building the project from inside VS 2019
but then this error is showing in VS 2019

And Here is the text version of that VS2019 Error

Code: C1083
Description: Cannot open include file: ‘Folder/TestActor.h’ No such file or directory
Project: TestProject
File: TestActor.cpp

Code: MSB3073
Description: The command ““D:\Installed Software\Epic Games\UE_4.27\Engine\Build\BatchFiles\Build.bat” TestProjectEditor Win64 Development -Project=“E:\Documents\3D\Unreal Engine Project\TestProject\TestProject.uproject” -WaitMutex -FromMsBuild” exited with code 6.
Project: TestProject
File: Microsoft.MakeFile.Targets

I would really appreciate any solution for this, I have no idea what’s going on

Unreal’s class generation doesn’t properly handle subdirectories so you will need to fix up the code yourself.

The code is doing

#include "Folder/TestActor.h"

That code is trying to find a file called TestActor.h in a sub directory which is incorrect as they are in the same directory. i.e it would be correct for the following

Source/
├─ TestProject/
│  ├─ Folder/
│  │  ├─ TestActor.cpp
│  │  ├─ Folder/
│  │  │  ├─ TestActor.h

So simply remove “Folder/”

1 Like

Really thank you for replaying

converting from #include “Folder/MyActor.h” to #Include “MyActor.h” in the cpp file and then manually building the project from Visual Studio worked

But why the auto generation is mistaking the Include path ? I didn’t had to do it manually before,
Is there any way fix the auto generation problem ?

Because Epic’s code that generates that doesn’t work if you don’t use public/private and have the class in a sub folder. I submitted a fix 3 years ago and it hasn’t received any activity from Epic (the PR is still open - https://github.com/EpicGames/UnrealEngine/pull/7819)

It should work correctly if you use Public/Private folders otherwise no unless you build the engine from source with my fix.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms