Blueprint/UserWidget.h issues

Hey guys, I’m trying to set up a HUD and have followed, what I think are, the proper steps to start messing with it.

In the .Build file, I included UMG, Slate, and SlateCore

		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay","UMG" });
        PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

So far so good here, no errors from this file. Now when I try to do

#include "Blueprint/UserWidget.h"

I get thrown an error saying cannot open source file “Blueprint/UserWidget.h”

So I THEN tried to do

#include "Runtime/UMG/Public/Blueprint/UserWidget.h"

which then ended up throwing me 216 errors, many of which are in the UserWidget.h file itself.
If anyone can spot what I’ve done wrong or point me in the direction of a solution, it’d be greatly appreciated.


Please attach the output log?

Hey, on my project i have

“UMG”, “Slate”, “SlateCore” in public dependencies ( you only have the first one )

and “Slate”, “SlateCore” in private ( you have them so it’s should be good )

#include "UserWidget.h"

if it still thow an error, check that your Uproject file ( edit with text ed ) has “UMG”, “Slate”, “SlateCore” in Modules → Additional Dependencies"

If you build from visual studio and not Engine, i suggest you to use the Output view and not the Error list, it give you the actual error detected by UE4 build system ( VisualStudio => View => Output )

I’m sorry but I unfortunately don’t know how to do that, I tried looking online to see how to save an output log, but I don’t think I’m either using for the right keywords or I’m not understanding what I’m reading

You’re right! The output view is a LOT better. It turns out I was getting an error completely unrelated to what the error list was telling me was the issue

BatteryCollector.generated.cpp.obj : error LNK2019: unresolved external symbol "public: float __cdecl ABatteryCollectorGameMode::GetPowerToWin(void)const " (?GetPowerToWin@ABatteryCollectorGameMode@@QEBAMXZ) referenced in function "public: void __cdecl ABatteryCollectorGameMode::execGetPowerToWin(struct FFrame &,void * const)" (?execGetPowerToWin@ABatteryCollectorGameMode@@QEAAXAEAUFFrame@@QEAX@Z)

which is in regards to this script, BatteryCollectorGameMode.H

	UFUNCTION(BlueprintPure, Category = "Power")
	float GetPowerToWin() const;

which was an issue because I was never actually calling the function in BatteryCollectorGameMode.cpp

Glad to see it helped you !

But yeah, i wasted hours using the error view…