I’m not sure why this is happening been following some code examples and found that when I try and create an FSlateDynamicImageBrush I get the following error:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FSlateDynamicImageBrush::FSlateDynamicImageBrush(class UTexture2D *,struct FVector2D const &,class FName,struct FLinearColor const &,enum ESlateBrushTileType::Type,enum ESlateBrushImageType::Type)" (__imp_??0FSlateDynamicImageBrush@@QEAA@PEAVUTexture2D@@AEBUFVector2D@@VFName@@AEBUFLinearColor@@W4Type@ESlateBrushTileType@@W45ESlateBrushImageType@@@Z) referenced in function "public: void __cdecl SetImage(class UTexture2D *)" (?SetImage@@QEAAXPEAVUTexture2D@@@Z)
Here is the relevant code that generates this linker error:
TSharedPtr<FSlateDynamicImageBrush> ButtonImage;
void SetImage(UTexture2D* Texture)
{
if (Texture != NULL)
{
ButtonImage.Reset();
ButtonImage = TSharedPtr<FSlateDynamicImageBrush>(new FSlateDynamicImageBrush(
Texture,
FVector2D(Texture->GetSizeX(), Texture->GetSizeY()),
Texture->GetFName()));
}
}
When I look at the prototype for the FSlateDynamicImageBrush the only difference I can see is that in the error it is handling the Texture->GetFName() request as passing a class instead of a const FName object to the constructor. When I rem out lines 7-10 it compiles without complaint but as soon as I put these lines back in the linker fails.