Failed to add C++ Widget class

Through the editor I try to add a c++ BlueprintWidget class.
It reaches 85%, and then the following message appears:

Methods I tried:

Tell me what files you guys need (as this is not a crash).


You should have some more details about why the build failed in the Output Log (Window → Developer Tools → Output Log), or your log file if you’ve since closed the editor (YourProject/Saved/Logs).

Could you post that here (or just attach your log), as that will help us know why your build is failing.

@Jamie Dale :diamonds: I hope this is the one (took the latest)link text

Hello kostor,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. What version of the engine are you using?
  2. Can you reproduce this in a clean project?
  3. If so, could you provide a detailed set of steps to reproduce this issue on our end?
  4. After receiving the error if you go into VS was the class actually created?

Curiously that log cuts out as the compilation starts. Is the editor still running? If so, can you check the Output Log and see if there’s anything under the line that starts: Launching UnrealBuildTool...?

@ :diamonds: Thank you for you fast response. As requested:

  1. UE 4.7.6-2513093

  2. I tried to open a new project and successfully reproduced it. Steps:
    Step One: Open a new C++, no starter content, Best Quality project. Name it whatever you like.
    Step Two: Navigate within you content browser to your c++ folder->your project’s name.
    Step Three: Right click-> New C++ Class
    Step four: Check “Show All Classes”
    Step Five: Select the WidgetBlueprint (hierarchy: BlueprintCore/Blueprint/Widget Blueprint)
    Step Six: Name it “HUDWidget” (without the “” of course).
    Step Seven: Create it. Wait for the problem.

  3. The class was created and I could edit its code in VS, though it would have no affect on the game and or engine.

P.S: You can run your game through either the code itself, or open it via the EPIC Launcher. It won’t work either way.

The UWidgetBlueprint class is inside the UMGEditor module, which won’t be linked in to your project by default. This is likely why your build is failing.

Typically this is just a case of adding the required dependency to your .Build.cs file, however as UMGEditor is an editor module, you’re going to need to make sure that you’re adding your new code to an editor-only module for your project. If you don’t already have one of those set-up, then this answer provides a how-to guide.

Let me know if you run in to any issues with this.

@Jamie Dale

Sorry, I didn’t see your comment. Hopefully you are not gone yet.

Launching UnrealBuildTool… [D:/Program Files/UE4/Unreal Engine/4.7/Engine/Binaries/DotNET/UnrealBuildTool.exe ReProduce -ModuleWithSuffix ReProduce 2126 Win64 Development -editorrecompile -canskiplink “D:/Yarden Utilite/UE4 Projects/ReProduce/ReProduce.uproject” -rocket -rocket]
CompilerResultsLog: New page: Compilation - Apr 22, 2015, 2:48:39 AM
CompilerResultsLog: Info Parsing headers for ReProduceEditor
CompilerResultsLog:Error: Error D:/Yarden Utilite/UE4 Projects/ReProduce/Source/ReProduce/HUDWidget.h(11) : Error: Superclass WidgetBlueprint of class HUDWidget not found
CompilerResultsLog:Error: Error Error: Failed to generate code for ReProduceEditor - error code: OtherCompilationError (2)
CompilerResultsLog: Info UnrealHeaderTool failed for target ‘ReProduceEditor’ (platform: Win64, module info: D:\Yarden Utilite\UE4 Projects\ReProduce\Intermediate\Build\Win64\ReProduceEditor\Development\UnrealHeaderTool.manifest).
LogMainFrame: MainFrame: Module compiling took 2.580 seconds
Warning: HotReload failed, recompile failed
Warning: RebindPackages failed because the compiler could not be started.
link text

@Jamie Dale :diamonds:
Error: “ReProduce could not be compiled. Try rebuilding from source manuall”

On other note: All I’m trying to do is to set a new widget for my future screen HUD through C++. Maybe we are getting carried away?

Hello kostor,

I was able to reproduce this issue on our end. I have written up a report ( UE-14222) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day

Extending UWidgetBlueprint is not how you make a new widget in c++. You should either extend from UWidget or UUserWidget. Use Uwidget if you’re wrapping a slate widget. Use Uuserwidget if you’re intending to make a new native parent class that you plan to swap out in the widget blueprint designer to be the new base class.

Thank you very much! now it is clear. If the devs could add more C++ documentation, references and explanations and examples it would be really appreciated (especially for beginners like me, I guess).
Thanks again! Good day!