Hi there!
I’ve been trying to create my own custom RichTextBlockDecorator in C++, and I’ve run into a problem which has me stumped. Whenever I try to compile code that uses a class that subclasses the FRichTextDecorator class, I get a linker error:
CompilerResultsLog: Error: MyRichTextBlockDecorator.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl FRichTextDecorator::FRichTextDecorator(class URichTextBlock *)" (??0FRichTextDecorator@@QEAA@PEAVURichTextBlock@@@Z) referenced in function "public: virtual class TSharedPtr<class ITextDecorator,0> __cdecl UMyRichTextBlockDecorator::Crea
teDecorator(class URichTextBlock *)" (?CreateDecorator@UMyRichTextBlockDecorator@@UEAA?AV?$TSharedPtr@VITextDecorator@@$0A@@@PEAVURichTextBlock@@@Z)
CompilerResultsLog: Error: MyRichTextBlockDecorator.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class TSharedRef<class ISlateRun,0> __cdecl FRichTextDecorator::Create(class TSharedRef<class FTextLayout,0> const &,struct FTextRunParseResults const &,class FString const &,class TSharedRef<class FString,0> const &,class ISlateStyle co
nst *)" (?Create@FRichTextDecorator@@UEAA?AV?$TSharedRef@VISlateRun@@$0A@@@AEBV?$TSharedRef@VFTextLayout@@$0A@@@AEBUFTextRunParseResults@@AEBVFString@@AEBV?$TSharedRef@VFString@@$0A@@@PEBVISlateStyle@@@Z)
CompilerResultsLog: Error: MyRichTextBlockDecorator.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class TSharedPtr<class SWidget,0> __cdecl FRichTextDecorator::CreateDecoratorWidget(struct FTextRunInfo const &,struct FTextBlockStyle const &)const " (?CreateDecoratorWidget@FRichTextDecorator@@MEBA?AV?$TSharedPtr@VSWidget@@$0A@@@AEB
UFTextRunInfo@@AEBUFTextBlockStyle@@@Z)
The code compiles just fine, it’s the linking part thats failing. Visual Studio shows no linter errors. I am including the
#include "Components/RichTextBlockDecorator.h"
component in my header file.
I’m not the best at parsing C++ linker errors but it seems to me that it fails to find the FRichTextDecorator class?
This is how my subclass of FRichTextDecorator looks like - stripped to the wire just to get something to compile…
This class is just defined in my c++ file.
class FRichInlineScaledImage : public FRichTextDecorator
{
public:
FRichInlineScaledImage(URichTextBlock* InOwner, UMyRichTextBlockDecorator* InDecorator)
: FRichTextDecorator(InOwner)
, Decorator(InDecorator)
{
}
virtual bool Supports(const FTextRunParseResults& RunParseResult, const FString& Text) const override
{
return false;
}
protected:
virtual TSharedPtr<SWidget> CreateDecoratorWidget(const FTextRunInfo& RunInfo, const FTextBlockStyle& TextStyle) const override
{
return NULL;
}
private:
UMyRichTextBlockDecorator* Decorator;
};
Please - does anyone have any idea what’s wrong?