# How to set button image in c++?

**URL:** <https://forums.unrealengine.com/t/how-to-set-button-image-in-c/470247>\
**Category:** UI\
**Tags:** button, image, unreal-engine, brush, Widget, question, CPP\
**Created:** [August 24, 2020, 1:16pm UTC](https://forums.unrealengine.com/t/how-to-set-button-image-in-c/470247 "2020-08-24T13:16:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew\_torkovich](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@andrew\_torkovich](https://forums.unrealengine.com/u/andrew_torkovich)\
**Post date:** [August 24, 2020, 1:16pm UTC](https://forums.unrealengine.com/t/how-to-set-button-image-in-c/470247/1 "2020-08-24T13:16:49Z")

</div>

This is how I tried to do this:

 ![311183-buttonimage1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/d/5/7d543f6569d7109e86a7250b341288b4a50852b6.png)

But it gives me an error:  
MainMenuWidget.cpp.obj : error LNK2019: unresolved external symbol “\_\_declspec(dllimport) public: struct FButtonStyle & \_\_cdecl FButtonStyle::SetNormal(struct FSlateBrush const &)” (\__imp_?SetNormal@FButtonStyle@@QEAAAEAU1@AEBUFSlateBrush@@@Z) referenced in function “protected: virtual void \_\_cdecl UMainMenuWidget::NativePreConstruct(void)” (?NativePreConstruct@UMainMenuWidget@@MEAAXXZ)

Help me please, I am not good in c++.

---

<div class="post-metadata">

**Author:** ![trx88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trx88](https://forums.unrealengine.com/u/trx88)\
**Post date:** [January 3, 2021, 11:36am UTC](https://forums.unrealengine.com/t/how-to-set-button-image-in-c/470247/2 "2021-01-03T11:36:36Z")

</div>

From the look of things, I had a similar problem when I was converting my Blueprint prototyping to C++ code, namely button style.  
FButtonStyle structure “lives” inside the Slate module, so you need to include that module in the build file.

Navigate to “ProjectName.Build.cs” in Visual Studio, and you’ll find a line of code that looks like this:

```
PublicDependencyModuleNames.AddRange(new string[] { "GameplayAbilities", "GameplayTags", "GameplayTasks", "AIModule", "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "UMG" });

```

Add this line below the one I mentioned:

```
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

```

You can find extra info here:  
[Including Slate](https://docs.unrealengine.com/en-US/ProgrammingAndScripting/Slate/Setup/index.html)
