Hey all,
I’ve been scratching my head for a couple of hours at this.
Whenever I create a UObjectLibrary derived class, I get thrown a lot of LNK 2001 errors that I’m not sure how to fix?
The errors:
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::OnAssetRegistryFilesLoaded(void)" (?OnAssetRegistryFilesLoaded@UObjectLibrary@@UEAAXXZ)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@UObjectLibrary@@UEAAXAEAUFPropertyChangedEvent@@@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@UObjectLibrary@@UEAAXAEAUFPropertyChangedEvent@@@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::PostLoad(void)" (?PostLoad@UObjectLibrary@@UEAAXXZ)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::PostLoad(void)" (?PostLoad@UObjectLibrary@@UEAAXXZ)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::UseWeakReferences(bool)" (?UseWeakReferences@UObjectLibrary@@UEAAX_N@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::UseWeakReferences(bool)" (?UseWeakReferences@UObjectLibrary@@UEAAX_N@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UObjectLibrary::AddObject(class UObject *)" (?AddObject@UObjectLibrary@@UEAA_NPEAVUObject@@@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UObjectLibrary::AddObject(class UObject *)" (?AddObject@UObjectLibrary@@UEAA_NPEAVUObject@@@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UObjectLibrary::RemoveObject(class UObject *)" (?RemoveObject@UObjectLibrary@@UEAA_NPEAVUObject@@@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UObjectLibrary::RemoveObject(class UObject *)" (?RemoveObject@UObjectLibrary@@UEAA_NPEAVUObject@@@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::GetAssetDataList(class TArray<struct FAssetData,class TSizedDefaultAllocator<32> > &)" (?GetAssetDataList@UObjectLibrary@@UEAAXAEAV?$TArray@UFAssetData@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::GetAssetDataList(class TArray<struct FAssetData,class TSizedDefaultAllocator<32> > &)" (?GetAssetDataList@UObjectLibrary@@UEAAXAEAV?$TArray@UFAssetData@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::ClearLoaded(void)" (?ClearLoaded@UObjectLibrary@@UEAAXXZ)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::ClearLoaded(void)" (?ClearLoaded@UObjectLibrary@@UEAAXXZ)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadAssetsFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &)" (?LoadAssetsFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadAssetsFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &)" (?LoadAssetsFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadBlueprintsFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &)" (?LoadBlueprintsFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadBlueprintsFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &)" (?LoadBlueprintsFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadAssetDataFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &,bool)" (?LoadAssetDataFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@_N@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadAssetDataFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &,bool)" (?LoadAssetDataFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@_N@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadBlueprintAssetDataFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &,bool)" (?LoadBlueprintAssetDataFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@_N@Z)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadBlueprintAssetDataFromPaths(class TArray<class FString,class TSizedDefaultAllocator<32> > const &,bool)" (?LoadBlueprintAssetDataFromPaths@UObjectLibrary@@UEAAHAEBV?$TArray@VFString@@V?$TSizedDefaultAllocator@$0CA@@@@@_N@Z)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadAssetsFromAssetData(void)" (?LoadAssetsFromAssetData@UObjectLibrary@@UEAAHXZ)
MyObjectLibrary.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UObjectLibrary::LoadAssetsFromAssetData(void)" (?LoadAssetsFromAssetData@UObjectLibrary@@UEAAHXZ)
MyObjectLibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UObjectLibrary::OnAssetRegistryFilesLoaded(void)" (?OnAssetRegistryFilesLoaded@UObjectLibrary@@UEAAXXZ)
The Code:
//.h
#pragma once
#include "CoreMinimal.h"
#include "Engine/ObjectLibrary.h"
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "AssetData.h"
#include "MyObjectLibrary.generated.h"
UCLASS()
class TEST_API UMyObjectLibrary : public UObjectLibrary
{
GENERATED_BODY()
public:
UMyObjectLibrary(const FObjectInitializer& ObjectInitializer);
};
//.cpp
#include "MyObjectLibrary.h"
UMyObjectLibrary::UMyObjectLibrary(const FObjectInitializer& ObjectInitializer)
{
}
Any help would be appreciated.
On a side note, looking online, there’s not a whole lot of tutorials or documentation of Object Libraries, why would that be?