Download

4.25 Can't compile Function

I have copied this function and used in various versions from 4.15 to 4.23 and it all compiles fine.

I am now trying to use 4.25 but I can not compile the following even though its copied directly from 4.23

This line is an issue with the : but I don’t know the syntax for how to fix it:


class PLAYBOOKGENERATIONS_API ULoadTxt : public UBlueprintFunctionLibrary


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

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "LoadTxt.generated.h"

/**
*
*/


UCLASS()
class PLAYBOOKGENERATIONS_API ULoadTxt : public UBlueprintFunctionLibrary
{
GENERATED_BODY() public:

UFUNCTION(BlueprintPure, Category = "Custom", meta = (Keywords = "LoadTxt"))
static bool LoadTxt(FString FileNameA, FString& SaveTextA);

UFUNCTION(BlueprintCallable, Category = "Custom", meta = (Keywords = "SaveTxt"))
static bool SaveTxt(FString SaveTextB, FString FileNameB, bool delFile);


};


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


#include "LoadTxt.h"



bool ULoadTxt::LoadTxt(FString FileNameA, FString& SaveTextA)
{
return FFileHelper::LoadFileToString(SaveTextA, *(FPaths::ProjectDir() + "/content/savedSchemes/" + FileNameA));
}

bool ULoadTxt::SaveTxt(FString SaveTextB, FString FileNameB, bool delFile)
{

if (delFile)
{
return FFileHelper::SaveStringToFile(SaveTextB, *(FPaths::ProjectDir() + "/content/savedSchemes/" + FileNameB));
}
else
{
return FFileHelper::SaveStringToFile(SaveTextB, *(FPaths::ProjectDir() + "/content/savedSchemes/" + FileNameB), FFileHelper::EEncodingOptions::AutoDetect, &IFileManager::Get(), EFileWrite::FILEWRITE_Append);
}
} 


 [1/6] LoadTxt.cpp
1>d:\ue4\projects\playcaller\source\playcaller\LoadTxt.h(15): error C2079: 'ULoadTxt' uses undefined class 'PLAYBOOKGENERATIONS_API'
1>d:\ue4\projects\playcaller\source\playcaller\LoadTxt.h(15): error C2143: syntax error: missing ';' before ':'
1>d:\ue4\projects\playcaller\source\playcaller\LoadTxt.h(15): error C2059: syntax error: ':'
1>d:\ue4\projects\playcaller\source\playcaller\LoadTxt.h(15): error C2059: syntax error: 'public'
1>d:\ue4\projects\playcaller\source\playcaller\LoadTxt.h(16): error C2143: syntax error: missing ';' before '{'
1>d:\ue4\projects\playcaller\source\playcaller\LoadTxt.h(16): error C2447: '{': missing function header (old-style formal list?)
1>D:\UE4\projects\PlayCaller\Source\PlayCaller\LoadTxt.cpp(6): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\UE4\projects\PlayCaller\Source\PlayCaller\LoadTxt.cpp(8): error C2027: use of undefined type 'ULoadTxt'
1> D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Source\PlayCaller\LoadTxt.cpp(13): error C2027: use of undefined type 'ULoadTxt'
1> D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1> [2/6] LoadTxt.gen.cpp
1>D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(15): error C2079: 'ULoadTxt' uses undefined class 'PLAYBOOKGENERATIONS_API'
1>D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(15): error C2143: syntax error: missing ';' before ':'
1>D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(15): error C2059: syntax error: ':'
1>D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(15): error C2059: syntax error: 'public'
1>D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(16): error C2143: syntax error: missing ';' before '{'
1>D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(16): error C2447: '{': missing function header (old-style formal list?)
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(21): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(28): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(28): error C3861: 'SaveTxt': identifier not found
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(31): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(37): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(37): error C3861: 'LoadTxt': identifier not found
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(40): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(42): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(42): error C2672: 'StaticClass': no matching overloaded function found
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(42): error C2783: 'UClass *StaticClass(void)': could not deduce template argument for 'ClassType'
1> D:\UE4\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/ReflectedTypeAccessors.h(13): note: see declaration of 'StaticClass'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(44): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(45): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(154): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(154): error C2672: 'StaticClass': no matching overloaded function found
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(154): error C2783: 'UClass *StaticClass(void)': could not deduce template argument for 'ClassType'
1> D:\UE4\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/ReflectedTypeAccessors.h(13): note: see declaration of 'StaticClass'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(182): error C2923: 'TCppClassTypeTraits': 'ULoadTxt' is not a valid template type argument for parameter 'CPPCLASS'
1> D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(15): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(182): error C2955: 'TCppClassTypeTraits': use of class template requires template argument list
1> D:\UE4\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/Class.h(2412): note: see declaration of 'TCppClassTypeTraits'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(183): warning C4305: 'initializing': truncation from 'TCppClassTypeTraits<CPPCLASS>::<unnamed-enum-IsAbstract>' to 'bool'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(185): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(185): error C2078: too many initializers
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(198): error C2440: 'initializing': cannot convert from 'overloaded-function' to 'UClass *(__cdecl *)(void)'
1> D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(198): note: None of the functions with this name in scope match the target type
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(208): error C2923: 'TClassCompiledInDefer': 'ULoadTxt' is not a valid template type argument for parameter 'TClass'
1> D:\UE4\projects\PlayCaller\Source\PlayCaller/LoadTxt.h(15): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(208): error C2514: 'TClassCompiledInDefer': class has no constructors
1> D:\UE4\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/UObjectBase.h(278): note: see declaration of 'TClassCompiledInDefer'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(208): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(208): error C3861: 'StaticPackage': identifier not found
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(208): error C2065: 'StaticClassFlags': undeclared identifier
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(208): error C2061: syntax error: identifier 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(210): error C2912: explicit specialization 'UClass *StaticClass<ULoadTxt>(void)' is not a specialization of a function template
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(211): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(211): error C2672: 'StaticClass': no matching overloaded function found
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(211): error C2783: 'UClass *StaticClass(void)': could not deduce template argument for 'ClassType'
1> D:\UE4\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\UObject/ReflectedTypeAccessors.h(13): note: see declaration of 'StaticClass'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(213): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(213): error C2664: 'FCompiledInDefer::FCompiledInDefer(FCompiledInDefer &&)': cannot convert argument 2 from 'UClass *(__cdecl *)(void)' to 'UClass *(__cdecl *)(void)'
1> D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(213): note: None of the functions with this name in scope match the target type
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(214): error C2027: use of undefined type 'ULoadTxt'
1> d:\ue4\projects\playcaller\intermediate\build\win64\ue4editor\inc\playcaller\LoadTxt.generated.h(99): note: see declaration of 'ULoadTxt'
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(214): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(214): error C2550: '{ctor}': constructor initializer lists are only allowed on constructor definitions
1>D:\UE4\projects\PlayCaller\Intermediate\Build\Win64\UE4Editor\Inc\PlayCaller\LoadTxt.gen.cpp(214): error C4508: '{ctor}': function should return a value; 'void' return type assumed
1> [3/6] PlayCaller.init.gen.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "D:\UE4\UE_4.25\Engine\Build\BatchFiles\Build.bat PlayCallerEditor Win64 Development -Project="D:\UE4\projects\PlayCaller\PlayCaller.uproject" -WaitMutex -FromMsBuild" exited with code 6.
1>Done building project "PlayCaller.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========


The log tells you the problem:



'ULoadTxt' uses undefined class 'PLAYBOOKGENERATIONS_API'


PLAYBOOKGENERATIONS_API doesn’t exist - which would be the case if you don’t have a module called “PlaybookGenerations”