# Failed to add C++ Widget class

**URL:** <https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865>\
**Category:** UI\
**Tags:** unreal-engine, Widget, question, CPP\
**Created:** [April 21, 2015, 8:21pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865 "2015-04-21T20:21:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kostor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kostor](https://forums.unrealengine.com/u/kostor)\
**Post date:** [April 21, 2015, 8:21pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/1 "2015-04-21T20:21:16Z")

</div>

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

[![](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/0/f03b3fba141b4be08ddedb688e0ca8193a5359dd.jpeg) ](https://snipboard.io/ZQsg5.jpg)

Methods I tried:

> **[Cannot compile - "delayimp.lib" not found](https://forums.unrealengine.com/questions/66873/cannot-open-delayimplib-when-compiling.html)**
>
> Hey guys! The full error message is: LINK : fatal error LNK1181: cannot open input file 'delayimp.lib’ I have no idea where this suddenly came from. Everything ran fine a few days ago. I hope anyone knows a solution to this 🙂 -CAPTNCAPS

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

Thanks.

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [April 21, 2015, 8:37pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/2 "2015-04-21T20:37:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kostor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kostor](https://forums.unrealengine.com/u/kostor)\
**Post date:** [April 21, 2015, 8:40pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/3 "2015-04-21T20:40:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [April 21, 2015, 8:43pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/4 "2015-04-21T20:43:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [April 21, 2015, 8:47pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/5 "2015-04-21T20:47:35Z")

</div>

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...`?

---

<div class="post-metadata">

**Author:** ![kostor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kostor](https://forums.unrealengine.com/u/kostor)\
**Post date:** [April 21, 2015, 8:56pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/6 "2015-04-21T20:56:01Z")

</div>

@ ♦ 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.

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [April 21, 2015, 9:16pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/7 "2015-04-21T21:16:06Z")

</div>

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](https://answers.unrealengine.com/questions/41509/extending-editor-engine.html) provides a how-to guide.

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

---

<div class="post-metadata">

**Author:** ![kostor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kostor](https://forums.unrealengine.com/u/kostor)\
**Post date:** [April 21, 2015, 9:18pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/8 "2015-04-21T21:18:38Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![kostor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kostor](https://forums.unrealengine.com/u/kostor)\
**Post date:** [April 21, 2015, 9:32pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/9 "2015-04-21T21:32:15Z")

</div>

@Jamie Dale ♦  
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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [April 22, 2015, 1:32pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/10 "2015-04-22T13:32:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NickDarnell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NickDarnell](https://forums.unrealengine.com/u/NickDarnell)\
**Post date:** [April 22, 2015, 2:33pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/11 "2015-04-22T14:33:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kostor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kostor](https://forums.unrealengine.com/u/kostor)\
**Post date:** [April 22, 2015, 2:41pm UTC](https://forums.unrealengine.com/t/failed-to-add-c-widget-class/315865/12 "2015-04-22T14:41:48Z")

</div>

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!
