Error Blueprint Function library Build

Hello,
I’m trying to compile this code without success to add it to my function library but I’m constantly falling back on these compilation errors that I can’t understand where the problem comes from.

Need help please

the code I’m trying to compile is as follows :

1>------ Début de la génération : Projet : MyProject, Configuration : Development_Editor x64 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.props(31,3): warning MSB4011: “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Makefile.props” ne peut pas être réimporté car il a déjà été importé à “C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props (31,3)”. Il s’agit probablement d’une erreur de création de build. Cette importation est ignorée. [C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\MyProject.vcxproj]
1>Compiling game modules for hot reload
1>Parsing headers for MyProjectEditor
1> Running UnrealHeaderTool “C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\MyProject.uproject” “C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Intermediate\Build\Win64\MyProjectEditor\Development\MyProjectEditor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -installed
1>Reflection code generated for MyProjectEditor in 11,1707875 seconds
1>Performing 5 actions (4 in parallel)
1>MyProject.init.gen.cpp
1>VictoryBPFunctionLibrary.cpp
1>VictoryBPFunctionLibrary.gen.cpp
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(11): error C2653: ‘UVictoryBPFunctionLibrary’: is not a class or namespace name
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(13): error C2550: ‘UVictoryBPFunctionLibrary’: constructor initializer lists are only allowed on constructor definitions
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(15): error C4508: ‘UVictoryBPFunctionLibrary’: function should return a value; ‘void’ return type assumed
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(18): error C2653: ‘UVictoryBPFunctionLibrary’: is not a class or namespace name
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(23): error C2653: ‘UVictoryBPFunctionLibrary’: is not a class or namespace name
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(30): error C2065: ‘GFileManager’: undeclared identifier
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(33): error C2065: ‘GFileManager’: undeclared identifier
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(33): error C2227: left of ‘->DirectoryExists’ must point to class/struct/union/generic type
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(33): note: type is ‘unknown-type’
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(36): error C2065: ‘GFileManager’: undeclared identifier
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(36): error C2227: left of ‘->MakeDirectory’ must point to class/struct/union/generic type
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(36): note: type is ‘unknown-type’
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(39): error C2065: ‘GFileManager’: undeclared identifier
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(39): error C2227: left of ‘->DirectoryExists’ must point to class/struct/union/generic type
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(39): note: type is ‘unknown-type’
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(55): error C2065: ‘GFileManager’: undeclared identifier
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(55): error C2227: left of ‘->GetFileAgeSeconds’ must point to class/struct/union/generic type
1>C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Source\MyProject\VictoryBPFunctionLibrary.cpp(55): note: type is ‘unknown-type’
1>ERROR : UBT error : Failed to produce item: C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-8954.dll
1>Total build time: 16,18 seconds (Local executor: 0,00 seconds)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(41,5): error MSB3075: La commande ““C:\Program Files\Epic Games\UE_4.18\Engine\Build\BatchFiles\Build.bat” MyProjectEditor Win64 Development “C:\Users\SIrin_NugDev\Documents\Unreal Projects\MyProject\MyProject.uproject” -waitmutex” s’est arrêtée avec le code 5. Assurez-vous d’avoir les droits suffisants pour exécuter cette commande.
1>Génération du projet “MyProject.vcxproj” terminée – ÉCHEC.
========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========

Hello.

The code you’re trying to compile contains type that doesn’t exist anymore (GFileManager).
The source you can see in that tutorial is extremely old and I’m not sure if it’ll even work, but GFileManager was possible replaced with IFileManager. You can get it like so:

IFileManager::Get()

Keep in mind tho, that it returns reference (not a pointer) so you’ll have to change the way you call functions on it (change arrows[->] to dots[.]). Example:

// Old code
GFileManager->DirectoryExists( *SaveDirectory)

// New code:
IFileManager::Get().DirectoryExists( *SaveDirectory)

Also, some/most of the functions used in tutorial might have change into different ones so you’d have to check FileHelper.h and see if you can find something that would work for you. Also, you might have to include that file in your .cpp file.

Cheers.