Hot Reload compile errors

Hi, I was having trouble referencing dot.h files that are in the Runtime folder with my project. I got it to work with

#include "Runtime/UMG/Public/Components/CanvasPanelSlot.h"

But now that I have done that, when I hit build in VS or the Compile button in the UE4 Editor I get the folllowing error in the Compile failed message.

The project could not be compiled. Would you like to open it in Visual Studio?

Running C:/Program Files (x86)/Unreal Engine/4.8/Engine/Binaries/DotNET/UnrealBuildTool.exe Sword_Of_Swords Development Win64 -project="C:/Users/stocker/Documents/Unreal Projects/Sword_Of_Swords/Sword_Of_Swords.uproject" -rocket -editorrecompile -progress -noubtmakefiles
Parsing headers for Sword_Of_SwordsEditor
C:/Users/stocker/Documents/Unreal Projects/Sword_Of_Swords/Source/Sword_Of_Swords/VoiceInput.h(25) : LogCompile:Error: Remapping old metadata key 'FriendlyName' to new key 'DisplayName', please update the declaration.
C:/Users/stocker/Documents/Unreal Projects/Sword_Of_Swords/Source/Sword_Of_Swords/VoiceInput.h(28) : LogCompile:Error: Remapping old metadata key 'FriendlyName' to new key 'DisplayName', please update the declaration.
C:/Users/stocker/Documents/Unreal Projects/Sword_Of_Swords/Source/Sword_Of_Swords/VoiceInput.h(31) : LogCompile:Error: Remapping old metadata key 'FriendlyName' to new key 'DisplayName', please update the declaration.
C:/Users/stocker/Documents/Unreal Projects/Sword_Of_Swords/Source/Sword_Of_Swords/VoiceInput.h(38) : LogCompile:Error: Remapping old metadata key 'FriendlyName' to new key 'DisplayName', please update the declaration.
LogCompile:Error: Could not find extern declaration for cross module reference Z_Construct_UClass_UCanvasPanelSlot_NoRegister()
LogCompile:Error: Could not find extern declaration for cross module reference Z_Construct_UClass_UCanvasPanelSlot_NoRegister()
Reflection code generated for Sword_Of_SwordsEditor
Performing 12 actions (4 in parallel)
[2/12] Resource ModuleVersionResource.rc.inl
[3/12] Resource PCLaunch.rc
PCH.Sword_Of_Swords.h.cpp
Sword_Of_Swords.generated.cpp
VoiceInput.cpp
MMOUtility.cpp
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(8) : error C2143: syntax error : missing ';' before '<class-head>'
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(10) : error C2143: syntax error : missing ';' before '<class-head>'
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(10) : error C2086: 'int VOICE_API' : redefinition
        c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(8) : see declaration of 'VOICE_API'
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(12) : error C2143: syntax error : missing ';' before '<class-head>'
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(12) : error C2086: 'int VOICE_API' : redefinition
        c:\program files (x86)\unreal engine\4.8\engine\source\runtime\online\voice\public\VoiceModule.h(8) : see declaration of 'VOICE_API'
SocketConnect.cpp
C:\Program Files (x86)\Unreal Engine\4.8\Engine\Source\Runtime/Online/OnlineSubsystemUtils/Public/OnlineSubsystemUtils.h(8) : fatal error C1083: Cannot open include file: 'Online.h': No such file or directory
C:\Program Files (x86)\Unreal Engine\4.8\Engine\Source\Runtime/UMG/Public/Components/CanvasPanelSlot.h(5) : fatal error C1083: Cannot open include file: 'Anchors.h': No such file or directory
C:\Program Files (x86)\Unreal Engine\4.8\Engine\Source\Runtime/Networking/Public/Networking.h(11) : fatal error C1083: Cannot open include file: 'Sockets.h': No such file or directory
C:\Program Files (x86)\Unreal Engine\4.8\Engine\Source\Runtime/UMG/Public/Components/CanvasPanelSlot.h(5) : fatal error C1083: Cannot open include file: 'Anchors.h': No such file or directory
Equipment.cpp
Sword_Of_Swords.cpp
ItemData.cpp
Sword_Of_SwordsGameMode.cpp
C:\Users\stocker\Documents\Unreal Projects\Sword_Of_Swords\Source\Sword_Of_Swords\ItemData.cpp(7): warning C4996: FPostConstructInitializeProperties is deprecated and was renamed to FObjectInitializer. Please use that type instead.
-------- End Detailed Actions Stats -----------------------------------------------------------
ERROR: UBT ERROR: Failed to produce item: C:\Users\stocker\Documents\Unreal Projects\Sword_Of_Swords\Binaries\Win64\UE4Editor-Sword_Of_Swords.dll
Total build time: 40.79 seconds

It sounds like you’re missing some dependencies in your .Build.cs file.

You’ll likely need to add the “Networking”, “Voice” and “UMG” modules to the PublicDependencyModuleNames or PrivateDependencyModuleNames array in your .Build.cs file.

Including the header file as you have will prevent UBT being able to define some symbols that you may need (such as the API macros for each module, eg) VOICE_API), and that will likely cause compile errors.

Thankyou Jamie, I did that and now is all fine.

If you’re getting this dependency problem because of the UMG module, don’t forget to uncomment the “Slate”, “SlateCore” option in your [SolutionName].Builds.cs file. (If your *.Builds.cs file doesn’t have this Slate comment, add “Slate”, “SlateCore” to the PrivateDependencyModuleNames)