# Unresolved External Symbol when Using Widget Component

**URL:** <https://forums.unrealengine.com/t/unresolved-external-symbol-when-using-widget-component/477790>\
**Category:** C++\
**Tags:** unresolved-external-, unreal-engine, Widget, question, CPP\
**Created:** [January 26, 2021, 4:41am UTC](https://forums.unrealengine.com/t/unresolved-external-symbol-when-using-widget-component/477790 "2021-01-26T04:41:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peemard](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/peemard/32/764258_2.png) [@Peemard](https://forums.unrealengine.com/u/Peemard)\
**Post date:** [January 26, 2021, 4:41am UTC](https://forums.unrealengine.com/t/unresolved-external-symbol-when-using-widget-component/477790/1 "2021-01-26T04:41:13Z")

</div>

Hi,  
I have been struggling with this issue for a few minutes now, and am unable to find a solution.

I am using a widget component attached to what is pretty much the default C++ character class, have it configured in my header and cpp files, and I have the #include file for the widget component.

**Here is the compile log error entry:**

```
GameName.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class UClass *__cdecl Z_Construct_UClass_UWidgetComponent_NoRegister(void)" (__imp_?Z_Construct_UClass_UWidgetComponent_NoRegister@@YAPEAVUClass@@XZ) referenced in function "void__cdecl `dynamic initializer for 'public: static struct UE4CodeGen_Private::FObjectPropertyParams const Z_Construct_UClass_AGameNameCharacter_Statics::NewProp_UIWidget''(void)" (??__E?NewProp_UIWidget@Z_Construct_UClass_AGameNameCharacter_Statics@@2UFObjectPropertyParams@UE4CodeGen_Private@@B@@YAXXZ)

```

**Here Is My Header**

```
		UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess = "true"))
		class UWidgetComponent* UIWidget;

```

**Here is my CPP**

```
#include "Components/WidgetComponent.h"	

// User Interface
		UIWidget = CreateDefaultSubobject<UWidgetComponent>(TEXT("User Widget"));
		UIWidget->SetupAttachment(FPCamera);

```

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Peemard](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/peemard/32/764258_2.png) [@Peemard](https://forums.unrealengine.com/u/Peemard)\
**Post date:** [January 27, 2021, 4:42am UTC](https://forums.unrealengine.com/t/unresolved-external-symbol-when-using-widget-component/477790/2 "2021-01-27T04:42:19Z")

</div>

Hey, so after some investigation this appears to have been an engine bug, because compiling the code in Visual Studio took care of it. As of right now I have been unable to reproduce the issue, although it is working perfectly fine now.

---

<div class="post-metadata">

**Author:** ![SteveDM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SteveDM](https://forums.unrealengine.com/u/SteveDM)\
**Post date:** [March 13, 2021, 7:31pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol-when-using-widget-component/477790/3 "2021-03-13T19:31:04Z")

</div>

I also had this error but couldn’t compile (currently using Rider, not VS). Turns out that in the PublicDependencyModuleNames of your build.cs file, you need to add “UMG” which fixes the problem.

---

<div class="post-metadata">

**Author:** ![WayOfTheWookie](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wayofthewookie/32/465208_2.png) [@WayOfTheWookie](https://forums.unrealengine.com/u/WayOfTheWookie)\
**Post date:** [July 13, 2021, 12:04pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol-when-using-widget-component/477790/4 "2021-07-13T12:04:46Z")

</div>

This right here is the answer. Odds are is that module wasn’t added the build cs file in OP’s post.

---

<div class="post-metadata">

**Author:** ![ShaunM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShaunM](https://forums.unrealengine.com/u/ShaunM)\
**Post date:** [June 2, 2025, 7:48pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol-when-using-widget-component/477790/5 "2025-06-02T19:48:28Z")

</div>

From four years in the future…

Updated Visual Studio and re-did all the requirements for working VS2022 with Unreal Engine 5.5 and ran into this problem. This solved my problem.
