#include "Blueprint/UserWidget.h" - MISSING

I am not sure if this is an issue that has been addressed somewhere already as I mainly refer to the documentation page and there are no release notes up for engine version 4.8 yet … but when attempting to learn the C++ programming guides in documentation for UMG … there is a gigantic failure occurring due to "Cannot open source file " error at the #include "Blueprint / UserWidget.h line (yes I am using Visual Studio :slight_smile: … not sure if this header was renamed… replaced… or just all out removed … some information of its whereabouts for engine version 4.8 would most appreciated
(also in case any doubt … I copy pasted the code from the documentation as well to reassure there were no typo’s and still same error)

I tried to reproduce your issue in my project and including "Blueprint/UserWidget.h" does compile. However, the visual studio intellisense does seem to give me the same error you described. A quick solution would be to include "Runtime/UMG/Public/Blueprint/UserWidget.h" instead.

If you’re project isn’t compiling you probably don’t have “UMG” as a dependency in your module rules.

##Better Solution

Found a proper solution moments after posting this answer. After you add “UMG” (or any dependency for that matter) you need to regenerate your visual studio project files. Do this by right clicking your .uproject file and click “Generate Visual Studio project files”. This way you can include "Blueprint/UserWidget.h" without getting that error.

You are best

I don’t see an option to “Generate Visual Studio project files” anywhere in Visual Studio when I right-click .uproject file in the solution explorer (didn’t really expect to either). I don’t see my .uproject file in the Content Browser in the UE4 editor. Where should I be clicking to get this option?

I found the answer to my question. It’s in the windows explorer where you see this option.

What if even that doesn’t work? I mean the include with the long address works, but then an include inside the UserWidget.h doesn’t work well.

If it doesn’t work you need to add “UMG” to your dependencies. Or whatever module is required for the header you’re trying to include.

I read that a lot of places, but I can’t find how to actually do that. Could you explain it a bit more?

You can add and remove your depdendencies in your *.Build.cs file for your project. Open it up and take a look.

You are right! I was blind not seeing that step.

Ran into this same issue, on video 16 of the Battery Collector C++ tutotorial.

Running VS 2015 on Win 10 with UE 4.10.

Compiles in the editor, builds in VS, but still has the squiggly.

Wish I could edit comments. Meant to finish with:

“Generating VS project” by right-clicking on the .uproject from within the file explorer in Windows (NOT in Visual Studio), then reloading the project in Visual Studio worked like a charm.

Massive thank you ! - stumbling on the first step is always scary ! - on with the tutorial :slight_smile:

Thank you for this! Kept right clicking my Visual Studios .uproject and what like what are you talking about! Lol.

Did that Windows Explorer and reloaded, compiled, and boom, problem solved!

Onward!

it works ! thx dude !

I am still getting an error on the C++ tutorial with regard to the Widgets(I think); I have read most(I think) of all the posts, added UMG to dependencies (including the slate and the other one), added the widget headers, generated the VS project as above by Dave Voyles in windows explorer of the project, but am still getting this error: CompilerResultsLog:Error: Error Thirdperson_unreal01.generated.cpp.obj : error LNK2019: unresolved external symbol "public: float __cdecl AThirdperson_unreal01GameMode::GetPowerToWin(void)const " (?GetPowerToWin@AThirdperson_unreal01GameMode@@QEBAMXZ) referenced in function “public: void __cdecl AThirdperson_unreal01GameMode::execGetPowerToWin(struct FFrame &,void * const)” (?execGetPowerToWin@AThirdperson_unreal01GameMode@@QEAAXAEAUFFrame@@QEAX@Z) CompilerResultsLog:Error: Error

Is it even the widget issue? appreciate any help

thanks, it helps me a lot!!

Thanks Man. You’re a genuis.