I’m trying to follow this tutorial: [Updating Data From a Text File at Runtime][1]
I’m not new to programming, but I am brand new to C++ and do not fully understand what I am doing. I tried following the steps in the tutorial exactly, but I keep running into this error.
If I am understanding correctly, I declared a method in the H file, but there is no reference to it in the CPP file, so when it goes to compile, it can’t find the library object and kicks out the error. So I think I’m supposed to link them or find some way to reference them, but I’m not sure how.
I also don’t know if this changes anything, but I have VS and UE4 installed on C:, but the project is on D:. I can’t move the project to C though because the file size is too big.
I believe that FFileHelper is the library it is trying to reference. That’s where the method is stored anyway, but I don’t know enough C++ to know if that even means what i think it means. I know Windows and I believe my project are 64 bit. I don’t know what the library is, but maybe that is a possible issue. I don’t know how I would be able to check for that.
I am really at my wit’s end on this. Any help would be greatly appreciated!
HFile Code
`
#include “CoreMinimal.h”
#include “Kismet/BlueprintFunctionLibrary.h”
#include
#include “RuntimeVariableBridge.generated.h”
/**
*
*/
UCLASS()
class VRHTTP_API URuntimeVariableBridge : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable, Category = "File I/O")
static FString LoadFileToString(FString Filename);
UFUNCTION(BlueprintCallable, Category = "File I/O")
static TArray<FString> LoadFileToStringArray(FString Filename);
};`
CPP Code
`
#include “RuntimeVariableBridge.h”
#include
#include
FString URuntimeVariableBridge::LoadFileToString(FString Filename)
{
FString directory = FPaths::ProjectContentDir();
FString result;
IPlatformFile& file = FPlatformFileManager::Get().GetPlatformFile();
if (file.CreateDirectory(*directory)) {
FString myFile = directory + "/" + Filename;
FFileHelper::LoadFileToString(result, *myFile);
}
return result;
}`
ERROR:
1>Building 2 actions with 8 processes…
1> [1/2] UE4Editor-VRHTTP.dll
1> Creating library D:\VR Projects\VRHTTP\Intermediate\Build\Win64\UE4Editor\Development\VRHTTP\UE4Editor-VRHTTP.suppressed.lib and object D:\VR Projects\VRHTTP\Intermediate\Build\Win64\UE4Editor\Development\VRHTTP\UE4Editor-VRHTTP.suppressed.exp
1>RuntimeVariableBridge.cpp.obj : error LNK2019: unresolved external symbol “private: static class TArray > __cdecl URuntimeVariableBridge::LoadFileToStringArray(class FString)” (?LoadFileToStringArray@URuntimeVariableBridge@@anonymous_user_42f44b0f?AV?$TArray@VFString@@anonymous_user_e71e0d8a1?$TSizedDefaultAllocator@$0CA@@@@@VFString@@@Z) referenced in function “public: static void __cdecl URuntimeVariableBridge::execLoadFileToStringArray(class UObject *,struct FFrame &,void * const)” (?execLoadFileToStringArray@URuntimeVariableBridge@@SAXPEAVUObject@@AEAUFFrame@@QEAX@Z)
1>RuntimeVariableBridge.gen.cpp.obj : error LNK2001: unresolved external symbol “private: static class TArray > __cdecl URuntimeVariableBridge::LoadFileToStringArray(class FString)” (?LoadFileToStringArray@URuntimeVariableBridge@@anonymous_user_42f44b0f?AV?$TArray@VFString@@anonymous_user_e71e0d8a1?$TSizedDefaultAllocator@$0CA@@@@@VFString@@@Z)
1>D:\VR Projects\VRHTTP\Binaries\Win64\UE4Editor-VRHTTP.dll : fatal error LNK1120: 1 unresolved externals
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command “D:\UE_4.23\Engine\Build\BatchFiles\Build.bat VRHTTPEditor Win64 Development -Project=“D:\VR Projects\VRHTTP\VRHTTP.uproject” -WaitMutex -FromMsBuild” exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project “VRHTTP.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========