Declaring FSlateBrush causing build errors, tried all forms of declarations. Engine version 4.20.3

So, when I’m declaring it directly as an object in the header file I get lots of linker issues:



2>PickUpActor.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FSlateBrush::FSlateBrush(void)" (__imp_??0FSlateBrush@@QEAA@XZ) referenced in function "public: __cdecl APickUpActor::APickUpActor(void)" (??0APickUpActor@@QEAA@XZ)

2>PickUpActor.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FSlateBrush::FSlateBrush(void)" (__imp_??0FSlateBrush@@QEAA@XZ)

2>PickUpActor.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FSlateBrush::~FSlateBrush(void)" (__imp_??1FSlateBrush@@UEAA@XZ) referenced in function "public: virtual __cdecl APickUpActor::~APickUpActor(void)" (??1APickUpActor@@UEAA@XZ)

2>InventoryComponent.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FSlateBrush::~FSlateBrush(void)" (__imp_??1FSlateBrush@@UEAA@XZ)

2>PickUpActor.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FSlateBrush::~FSlateBrush(void)" (__imp_??1FSlateBrush@@UEAA@XZ)

When I add a UPROPERTY(EditAnywhere) I get this in addition to the previous:


2>PickUpActor.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class UScriptStruct * __cdecl Z_Construct_UScriptStruct_FSlateBrush(void)" (__imp_?Z_Construct_UScriptStruct_FSlateBrush@@YAPEAVUScriptStruct@@XZ) referenced in function "void __cdecl `dynamic initializer for 'public: static struct UE4CodeGen_Private::FStructPropertyParams const Z_Construct_UClass_APickUpActor_Statics::NewProp_brush''(void)" (??__E?NewProp_brush@Z_Construct_UClass_APickUpActor_Statics@@2UFStructPropertyParams@UE4CodeGen_Private@@B@@YAXXZ)

So, lets try and declare a FSlateRush pointer instead, without the UPROPERTY macro … HUUURRAAAY, IT BUILDS! Lets try and add a UPROPERTY so I can actually choose an image in the editor: UPROPERTY(EditAnywhere). Now it doesn’t build again, this time with completely different errors:



2>C:/Repos/Remnant/Source/Remnant/PuzzleSystem/Actors/PickUpActor.h(34): error : Inappropriate '*' on variable of type 'FSlateBrush', cannot have an exposed pointer to this type.


I’ve even tried to hack it and declare it as a:



UPROPERTY(EditAnywhere)
TSubClassOf<FSlateBrush> brush;


this way I could just cast it to the FSlateBrush class when using it, however, now I get these errors:



2>C:/Repos/Remnant/Source/Remnant/PuzzleSystem/Actors/PickUpActor.h(34): error : Class 'FSlateBrush' not found.


The use-case for this: Add brushes to pickup items, so that they can affect my Inventory icons in the UI. The plan is to get a pointer to my UMG widget, then the inventory icon image and set it’s brush to the latest pickups’ brush.

To clear some things out; yes I have included the brush’s header


#include "Styling/SlateBrush.h"

in my own header file, I’m also declaring my brush variable in my header file, I’ve tried both in public and private with the same results. I’ve also tried it in both actor classes and actor component classes with the same result.

My engine version is 4.20.3, I have no idea how to fix this or procede, help is extremely appreciated!

For future references if anyone else has the same issues and I had. Take a look in your “Projectname.Build.cs”. In there you will find:



// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string] { "Slate", "SlateCore" });


7 Likes

Hi I was wondering if you could point me in the right direction, brief back story to goal and then issues faced. I had a project to build the sound for a game slice for a university project, being an audio engineer with little programming knowledge Unreal was a steep learning curve. I would like to get the created level out as a playable level. I tried exporting as HTML but the earlier version of UE, would not export, it kept throwing up webassembly messages and so after reading a lot about this issue I downloaded a newer version of the engine. The project then would compile in the new version so I downloaded XCode, and Visual code and visual studio and all the required possible extensions. After getting the loading error I loaded it into X-Code…which took a while, a long while…good god that took a while, anyway I digress, this is the message I get now about Fslate brush. Is there a simple way to solve this so that I can open the project in a newer version to then package it for HTML5 and showcase the sound design on my portfolio?
please say there is, its killing me a little inside every time I think about it. :slight_smile:

Thank you sir! You saved my sanity!