Error LNK2001/LNK2019/LNK1120 unresolved external symbols on STextBlockStyle

Hi,

I’m trying to create a new RichTextDecorator that works like the URichTextBlockImageDecorator but insted of images it prints a TextBlock with text and style from a DataTable.
I’m new to C++ and I’m following this example (Github Nauja/ue4-richtextblocktooltip-sample) and the code from the engine.
The problem comes when I try to use any of this classes or functions: SNew, STextBlock, FTextBlockStyle.

Here’s an example of just declaring a property of type FTextBlockStyle on the new FTableRowBase. I’ve tried some includes, but I haven’t found the one. (I am not including all the code of the Decorator because it generates the same errors and I have it commented to isolate just 1 problem at the same time).

KeyToTextTableRow.h

#pragma once

#include "CoreMinimal.h"
#include "Engine/DataTable.h"

#include "KeyToTextTableRow.generated.h"

USTRUCT(Blueprintable, BlueprintType)
struct FOO_API FKeyToTextTableRow : public FTableRowBase
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, Category = Appearence)
	FText ContentText;

	// IF THIS IS COMMENTED NO ERROR APPEARS, IS ALSO NOT IN USE ATM CAUSE THE ERROR...
	UPROPERTY(EditAnywhere, Category = Appearence)
	FTextBlockStyle TextStyle;
	
};

Console output:

....

Building 6 actions with 3 processes...
  [1/6] Compile [x64] FOO.init.gen.cpp
  [2/6] Compile [x64] KeyToTextTableRow.gen.cpp
  [3/6] Compile [x64] KeyToTextRichTextBlockDecorator.cpp
  [4/6] Compile [x64] KeyToTextTableRow.cpp
  [5/6] Compile [x64] KeyToTextRichTextBlockDecorator.gen.cpp
  [6/6] Compile [x64] KeyToTextRichTextDecorator.cpp
  Total time in Parallel executor: 8.06 seconds
  Total execution time: 89.44 seconds
File <ProjectDir>\Intermediate\Build\Win64\x64\UnrealEditor\Development\FOO\KeyToTextRichTextBlockDecorator.cpp.obj was modified or is new
File <ProjectDir>\Intermediate\Build\Win64\x64\UnrealEditor\Development\FOO\KeyToTextRichTextBlockDecorator.gen.cpp.obj was modified or is new
File <ProjectDir>\Intermediate\Build\Win64\x64\UnrealEditor\Development\FOO\KeyToTextRichTextDecorator.cpp.obj was modified or is new
File <ProjectDir>\Intermediate\Build\Win64\x64\UnrealEditor\Development\FOO\KeyToTextTableRow.cpp.obj was modified or is new
File <ProjectDir>\Intermediate\Build\Win64\x64\UnrealEditor\Development\FOO\KeyToTextTableRow.gen.cpp.obj was modified or is new
File <ProjectDir>\Intermediate\Build\Win64\x64\UnrealEditor\Development\FOO\FOO.init.gen.cpp.obj was modified or is new
Building patch from 6 file(s) for Live coding module <ProjectDir>\Binaries\Win64\UnrealEditor-FOO.dll
   Creating library <ProjectDir>\Binaries\Win64\UnrealEditor-FOO.patch_14.lib and object <ProjectDir>\Binaries\Win64\UnrealEditor-FOO.patch_14.exp
KeyToTextTableRow.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(void)" (__imp_??0FTextBlockStyle@@QEAA@XZ)
KeyToTextRichTextBlockDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(void)" (__imp_??0FTextBlockStyle@@QEAA@XZ)
KeyToTextRichTextBlockDecorator.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(void)" (__imp_??0FTextBlockStyle@@QEAA@XZ)
KeyToTextRichTextDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(void)" (__imp_??0FTextBlockStyle@@QEAA@XZ)
KeyToTextTableRow.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(void)" (__imp_??0FTextBlockStyle@@QEAA@XZ)
KeyToTextTableRow.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FTextBlockStyle::~FTextBlockStyle(void)" (__imp_??1FTextBlockStyle@@UEAA@XZ)
KeyToTextRichTextBlockDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FTextBlockStyle::~FTextBlockStyle(void)" (__imp_??1FTextBlockStyle@@UEAA@XZ)
KeyToTextRichTextBlockDecorator.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FTextBlockStyle::~FTextBlockStyle(void)" (__imp_??1FTextBlockStyle@@UEAA@XZ)
KeyToTextRichTextDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FTextBlockStyle::~FTextBlockStyle(void)" (__imp_??1FTextBlockStyle@@UEAA@XZ)
KeyToTextTableRow.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FTextBlockStyle::~FTextBlockStyle(void)" (__imp_??1FTextBlockStyle@@UEAA@XZ)
KeyToTextTableRow.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(struct FTextBlockStyle const &)" (__imp_??0FTextBlockStyle@@QEAA@AEBU0@@Z)
KeyToTextRichTextBlockDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(struct FTextBlockStyle const &)" (__imp_??0FTextBlockStyle@@QEAA@AEBU0@@Z)
KeyToTextRichTextBlockDecorator.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(struct FTextBlockStyle const &)" (__imp_??0FTextBlockStyle@@QEAA@AEBU0@@Z)
KeyToTextRichTextDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(struct FTextBlockStyle const &)" (__imp_??0FTextBlockStyle@@QEAA@AEBU0@@Z)
KeyToTextTableRow.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FTextBlockStyle::FTextBlockStyle(struct FTextBlockStyle const &)" (__imp_??0FTextBlockStyle@@QEAA@AEBU0@@Z)
KeyToTextTableRow.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct FTextBlockStyle & __cdecl FTextBlockStyle::operator=(struct FTextBlockStyle const &)" (__imp_??4FTextBlockStyle@@QEAAAEAU0@AEBU0@@Z)
KeyToTextRichTextBlockDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct FTextBlockStyle & __cdecl FTextBlockStyle::operator=(struct FTextBlockStyle const &)" (__imp_??4FTextBlockStyle@@QEAAAEAU0@AEBU0@@Z)
KeyToTextRichTextBlockDecorator.gen.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct FTextBlockStyle & __cdecl FTextBlockStyle::operator=(struct FTextBlockStyle const &)" (__imp_??4FTextBlockStyle@@QEAAAEAU0@AEBU0@@Z)
KeyToTextRichTextDecorator.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct FTextBlockStyle & __cdecl FTextBlockStyle::operator=(struct FTextBlockStyle const &)" (__imp_??4FTextBlockStyle@@QEAAAEAU0@AEBU0@@Z)
KeyToTextTableRow.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct FTextBlockStyle & __cdecl FTextBlockStyle::operator=(struct FTextBlockStyle const &)" (__imp_??4FTextBlockStyle@@QEAAAEAU0@AEBU0@@Z)
KeyToTextTableRow.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class UScriptStruct * __cdecl Z_Construct_UScriptStruct_FTextBlockStyle(void)" (__imp_?Z_Construct_UScriptStruct_FTextBlockStyle@@YAPEAVUScriptStruct@@XZ) referenced in function "void __cdecl `dynamic initializer for 'public: static struct UECodeGen_Private::FStructPropertyParams const Z_Construct_UScriptStruct_FKeyToTextTableRow_Statics::NewProp_TextStyle''(void)" (??__E?NewProp_TextStyle@Z_Construct_UScriptStruct_FKeyToTextTableRow_Statics@@2UFStructPropertyParams@UECodeGen_Private@@B@@YAXXZ)
<ProjectDir>\Binaries\Win64\UnrealEditor-FOO.patch_14.exe : fatal error LNK1120: 5 unresolved externals
Failed to link patch (0.000s) (Exit code: 0x460)
---------- Finished (0.000s) ----------

Thanks in advance…

1 Like

You should avoid making changes and compiling a .h (header file) while the editor is running.

Have you ensured that “Slate” and “SlateCore” is added to your project build.cs file in the PrivateDependencyModuleNames array?

It’s fixed!! It was the lack of Slate and SlateCore on the project build.cs.

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.