So, annoyingly, the header tool chokes once again on a common feature of C++. This time it throws a compile error when trying to compile a UFUNCTION that takes a USTRUCT type that has been forward declared in the header file.
Header:
#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "StageUtilities.generated.h"
struct FStageParams; // Forward declaration
UCLASS()
class UStageUtilities : public UBlueprintFunctionLibrary
{
GENERATED_BODY() // <<<<< Error points to this line
public:
UFUNCTION(BlueprintPure, Category = "Stage") // <<<<< Caused by this
static FName GetLevelNameFromStageParams(const FStageParams params);
private:
};
The compile errors are:
error C2079: 'Z_Param_params' uses undefined struct 'FStageParams'
error C2664: 'FName UStageUtilities::GetLevelNameFromStageParams(const FStageParams)' : cannot convert argument 1 from 'int' to 'const FStageParams'
Removing the UFUNCTION macro let’s it compile correctly, so it seems like it’s just a failure of the header tool to be able to recognize forward declarations, though if that were the case I feel like more people would have ran into this issue. So what’s the deal here? Why can’t it recognize the forward declaration? And what the hell is Z_Param_params?