Making a constructor for own blueprint function library class

I am having compilation troubles with with my blueprint function library class. It keeps giving me Z_Param_value errors as shown below and I have read I can’t actually change the constructor if something inherits UObject. I referenced this page A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
for its constructor, and earlier had a UAchievementFile() constructor below the GENERATED_UCLASS_BODY(). The compilation errors I get are below.

// .h file
UCLASS()
class PROTOTYPE_API UAchievementFile : public UBlueprintFunctionLibrary
{
  GENERATED_UCLASS_BODY()
	
  public:

  // functions for use
  UFUNCTION(BlueprintCallable, Category = "File", meta = (Keywords = "AchievementUnlocked"))
  static void AchievementUnlocked(Achievements value);

  UFUNCTION(BlueprintCallable, Category = "File", meta = (Keywords = "AchievementMissed"))
  static void AchievementMissed(Achievements value);

  UFUNCTION(BlueprintCallable, Category = "File", meta = (Keywords = "UpdateAchievementList"))
  static void UpdateAchievementList();

  private :
  
  //
    static UDataTable* Achievements;

  static FString AchievementFile;
  static FString CurrentRunFile;
	
  static const FString EnumToString(const TCHAR* Enum, int32 EnumValue);

};

// .cpp important part

UAchievementFile::UAchievementFile(const class FPostConstructInitializeProperties& PCIP)
  : Super(PCIP)
{
  AchievementFile = "SummerBear\\Remote\\repo\\Prototype\\Achievementlist.txt";
  CurrentRunFile = "SummerBear\\Remote\\repo\\Prototype\\CurrentAchievements.txt";


  ConstructorHelpers::FObjectFinder<UDataTable> Achievements_BP(TEXT("Remote\\repo\\Prototype\\Content\\Data\\Achiements.uasset"));
  Achievements = Achievements_BP.Object;

  //FExcelData* RowLookUp = ExcelTable->FindRow<FDGExcellData>(TEXT("Enemy1"), TEXT("LookUp Operation"));
}

Log:

Info Compiling game modules for hot reload
Info Parsing headers for PrototypeEditor
Info   Running UnrealHeaderTool "C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Prototype.uproject" "C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Intermediate\Build\Win64\PrototypeEditor\Development\PrototypeEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Info Reflection code generated for PrototypeEditor in 12.4849113 seconds
Info Performing 4 actions (2 in parallel)
Info Prototype.generated.cpp
Info AchievementFile.cpp
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.h(42) : error C2146: syntax error: missing ';' before identifier 'Z_Param_value'c:\users\owner\desktop\summerbear\remote\repo\prototype\source\prototype\AchievementFile.h(42): error C2146: syntax error: missing ';' before identifier 'Z_Param_value'
Info 
Error c:\users\owner\desktop\summerbear\remote\repo\prototype\source\prototype\AchievementFile.h(42) : error C2065: 'Z_Param_value': undeclared identifier
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.h(42) : error C2065: 'Z_Param_value': undeclared identifierc:\users\owner\desktop\summerbear\remote\repo\prototype\source\prototype\AchievementFile.h(42): error C2143: syntax error: missing ';' before 'constant'
Info 
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.h(42) : error C2143: syntax error: missing ';' before 'constant'
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.cpp(7) : error C2143: syntax error: missing ')' before '('
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.cpp(7) : error C2206: 'UAchievementFile::{ctor}': typedef cannot be used for function definition
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.cpp(7) : error C2059: syntax error: '&'
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.cpp(7) : error C2059: syntax error: ')'
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.cpp(8) : error C2065: 'PCIP': undeclared identifier
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Source\Prototype\AchievementFile.cpp(9) : error C2448: 'Super': function-style initializer appears to be a function definition
Info ERROR: UBT ERROR: Failed to produce item: C:\Users\Owner\Desktop\SummerBear\Remote\repo\Prototype\Binaries\Win64\UE4Editor-Prototype-7881.dll
Info Total build time: 101.99 seconds (Local executor: 0.00 seconds)

Regardless of whether I derive the class from UObject or UBlueprintFunctionLibrary and whether I implemented the constructor or not, I receive the syntax error/ Z_Param_value error on GENERATED_BODY(). A buddy thought it might be the generated.h file not properly generating, but I even copied it over to a new class and started fresh and it doesn’t work. I have an enum and a struct declared above the class, but neither cause me errors.

EDIT: the error happened due to having member variables in the class, so now I’m curious how I can have member variables.

There one misunderstanding in community, static nodes for blueprint don’t require UBlueprintFunctionLibrary at all. I suspect this base class was made just for static function does not fit elsewhere (in case of engine code, engine use this if other class is not compatible with reflection system, like FMath) and static function blueprint nodes will work from everywhere. If you look up in to UBlueprintFunctionLibrary it does not really have any relevant code, it’s pretty much empty.

I saying this as you seem to forcing yourself to use UBlueprintFunctionLibrary just because you want to make blueprint nodes, where clearly you really want to create normal object class, and you could even use AGameMode itself or create UAchievementFile (from notmal UObject) there and access it from there, that which later you can access via GEnigne in those static functions (which i assume you use because you don’t want to have “Target” pin).

That said you probably should use GENERATED_BODY() instead, then declare constructor, just UAchievementFile::UAchievementFile() and it should work without issues. Remember you need to create a object in order for constructor to be executed.

What is the ‘Achievements’ parameter in your functions? The name clashes with your static member, which is not a great idea. But more to the point, UFUNCTIONs support only certain reflected types in their parameters. This is most likely the cause of your error.

Be aware that it’s also unsafe to keep a non-UPROPERTY pointer to a data table, unless you call AddToRoot on it to prevent it from being garbage collected.

Also do as @anonymous_user_f5a50610 says and derive from UObject. The function library base class explicitly says all derived class methods must be static, I don’t think you are supposed to add a constructor.