# “no default constructor exists for class ”UUserWidget“”

**URL:** <https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077>\
**Category:** C++\
**Tags:** UE4-18, constructors, unreal-engine, CPP, question\
**Created:** [January 20, 2018, 6:07pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077 "2018-01-20T18:07:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![xSheim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xSheim](https://forums.unrealengine.com/u/xSheim)\
**Post date:** [January 20, 2018, 6:07pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/1 "2018-01-20T18:07:17Z")

</div>

I have experienced a strange issue writing the constructor of UUserWidget-inherited class. The problem appears only (checked in several other) in this class. Code: [.h](https://i.stack.imgur.com/G2OH9.png) [.cpp](https://i.stack.imgur.com/qqH2p.png) [UserWidget.h](https://i.stack.imgur.com/4Wlft.png)

---

<div class="post-metadata">

**Author:** ![vr\_marco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vr_marco/32/1194556_2.png) [@vr\_marco](https://forums.unrealengine.com/u/vr_marco)\
**Post date:** [January 20, 2018, 6:32pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/2 "2018-01-20T18:32:22Z")

</div>

Did you add the dependencies from UMG and Slate in your Build.cs file?

---

<div class="post-metadata">

**Author:** ![xSheim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xSheim](https://forums.unrealengine.com/u/xSheim)\
**Post date:** [January 20, 2018, 8:32pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/3 "2018-01-20T20:32:49Z")

</div>

Yes I did.

---

<div class="post-metadata">

**Author:** ![xSheim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xSheim](https://forums.unrealengine.com/u/xSheim)\
**Post date:** [January 20, 2018, 8:44pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/4 "2018-01-20T20:44:34Z")

</div>

Ok I have solved the issue.

 ![227773-screenshot-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/b/d3b6aa9a1bfc0d37e8e3ef5f03a98f0cf902e43d.png)

Thanks for your answer.

---

<div class="post-metadata">

**Author:** ![vr\_marco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vr_marco/32/1194556_2.png) [@vr\_marco](https://forums.unrealengine.com/u/vr_marco)\
**Post date:** [January 20, 2018, 8:52pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/5 "2018-01-20T20:52:56Z")

</div>

Oh, right! I hadn’t noticed you were not calling the constructor of the parent class. You should mark you answer as accepted so others can find it in the future.

---

<div class="post-metadata">

**Author:** ![xSheim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xSheim](https://forums.unrealengine.com/u/xSheim)\
**Post date:** [January 20, 2018, 8:58pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/6 "2018-01-20T20:58:28Z")

</div>

The solution:

 ![227773-screenshot-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/b/d3b6aa9a1bfc0d37e8e3ef5f03a98f0cf902e43d.png)

As @vr_marco said: I had to “call the constructor of the parent class”.

---

<div class="post-metadata">

**Author:** ![L11777](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@L11777](https://forums.unrealengine.com/u/L11777)\
**Post date:** [February 15, 2019, 5:31pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/7 "2019-02-15T17:31:35Z")

</div>

Why? Why does this need to be done? Under what circumstances does this happen and why?

---

<div class="post-metadata">

**Author:** ![Brian2524](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Brian2524](https://forums.unrealengine.com/u/Brian2524)\
**Post date:** [May 27, 2019, 10:28pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/8 "2019-05-27T22:28:00Z")

</div>

Im wondering the same thing. All this stuff is so poorly documented …

---

<div class="post-metadata">

**Author:** ![Lardo\_Deepdelver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lardo\_Deepdelver](https://forums.unrealengine.com/u/Lardo_Deepdelver)\
**Post date:** [May 29, 2019, 1:36pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/9 "2019-05-29T13:36:19Z")

</div>

This is not unreal specific, that’s C++ behavior

basically, you need to do it in any case where the constructor of your base class needs data that you hand in from the child constructor.

In that case, what happened is that if you don’t call a parent constructor the default constructor was being called and the parent class doesn’t have one, which leads to the error

---

<div class="post-metadata">

**Author:** ![LuisAlaguna](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luisalaguna/32/570408_2.png) [@LuisAlaguna](https://forums.unrealengine.com/u/LuisAlaguna)\
**Post date:** [August 8, 2019, 12:02pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/10 "2019-08-08T12:02:30Z")

</div>

For example:

> FObjectFinders can’t be used outside  
> of constructors to find  
> /UI/Icons/home-outline

---

<div class="post-metadata">

**Author:** ![vishal-ahirwar](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vishal-ahirwar/32/634878_2.png) [@vishal-ahirwar](https://forums.unrealengine.com/u/vishal-ahirwar)\
**Post date:** [December 13, 2022, 6:12pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/11 "2022-12-13T18:12:42Z")

</div>

```auto
UMainMenu::UMainMenu(const FObjectInitializer&Object):Super(Object)
{

	ConstructorHelpers::FClassFinder<UUserWidget> ServerWidgetClass(TEXT("'/Game/UI/MenuSystem/WP_Server'"));
	if (ServerWidgetClass.Class)this->ServerWidget = ServerWidgetClass.Class;
};

```

---

<div class="post-metadata">

**Author:** ![1xu7](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/1xu7/32/88708_2.png) [@1xu7](https://forums.unrealengine.com/u/1xu7)\
**Post date:** [January 22, 2023, 5:20pm UTC](https://forums.unrealengine.com/t/no-default-constructor-exists-for-class-uuserwidget/415077/12 "2023-01-22T17:20:25Z")

</div>

in my case, this had served me to load assets for my widgets…
