[BUG?] Can't build project with UDataTable

I create c++ class DataTable from wizard, closed editor and try to compile. Parsing is ok, but project is not building.

.H

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Engine/DataTable.h"
#include "MyDataTable.generated.h"

/**
 * 
 */
UCLASS()
class MYRUNNER_API UMyDataTable : public UDataTable
{
	GENERATED_BODY()

};

.CPP

// Fill out your copyright notice in the Description page of Project Settings.

#include "MyRunner.h"
#include "MyDataTable.h"

Output

1>------ Build started: Project: MyRunner, Configuration: Development_Editor x64 ------
1>  Parsing headers for MyRunnerEditor
1>  Reflection code generated for MyRunnerEditor
1>  Performing 8 actions (4 in parallel)
1>  PCH.MyRunner.MyRunner.h.cpp
1>  MyRunner.generated.cpp
1>  MyRunnerGameMode.cpp
1>  StrucGenerator.cpp
1>  MyDataTable.cpp
1>  MyRunnerCharacter.cpp
1>  MyRunner.cpp
1>  [8/8] Link UE4Editor-MyRunner.dll
1>     Creating library C:\Users\\Documents\Unreal Projects\MyRunner\Intermediate\Build\Win64\MyRunnerEditor\Development\UE4Editor-MyRunner.lib and object C:\Users\\Documents\Unreal Projects\MyRunner\Intermediate\Build\Win64\MyRunnerEditor\Development\UE4Editor-MyRunner.exp
1>MyDataTable.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UDataTable::FinishDestroy(void)" (?FinishDestroy@UDataTable@@UEAAXXZ)
1>MyRunner.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UDataTable::FinishDestroy(void)" (?FinishDestroy@UDataTable@@UEAAXXZ)
1>MyDataTable.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UDataTable::Serialize(class FArchive &)" (?Serialize@UDataTable@@UEAAXAEAVFArchive@@@Z)
1>MyRunner.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UDataTable::Serialize(class FArchive &)" (?Serialize@UDataTable@@UEAAXAEAVFArchive@@@Z)
1>MyRunner.generated.cpp.obj : error LNK2019: unresolved external symbol "public: static void __cdecl UDataTable::AddReferencedObjects(class UObject *,class FReferenceCollector &)" (?AddReferencedObjects@UDataTable@@SAXPEAVUObject@@AEAVFReferenceCollector@@@Z) referenced in function "void __cdecl GetPrivateStaticClassBody<class UMyDataTable>(wchar_t const *,wchar_t const *,class UClass * &,void (__cdecl*)(void))" (??$GetPrivateStaticClassBody@VUMyDataTable@@@@YAXPEB_W0AEAPEAVUClass@@P6AXXZ@Z)
1>C:\Users\\Documents\Unreal Projects\MyRunner\Binaries\Win64\UE4Editor-MyRunner.dll : fatal error LNK1120: 3 unresolved externals
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: C:\Users\\Documents\Unreal Projects\MyRunner\Binaries\Win64\UE4Editor-MyRunner.dll
1>  Cumulative action seconds (4 processors): 0,00 building projects, 3,11 compiling, 0,00 creating app bundles, 0,00 generating debug info, 0,12 linking, 0,00 other
1>  UBT execution time: 8,81 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Program Files\Epic Games\4.7\Engine\Build\BatchFiles\Build.bat" MyRunnerEditor Win64 Development "C:\Users\\Documents\Unreal Projects\MyRunner\MyRunner.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Hello, Ibragim

I am sorry to hear about your issue.

To fix it, please add ENGINE_API macro to definitions of FinishDestroy(), Serialize() and AddReferencedObjects() methods in DataTable.h and rebuild the Engine:

ENGINE_API virtual void FinishDestroy() override;
ENGINE_API virtual void Serialize(FArchive& Ar) override;
ENGINE_API static void AddReferencedObjects(UObject* InThis, FReferenceCollector& Collector);

Hope this helped!

Have a great day!

may this one help you: