Compile errors in generated files ?

Hi, I have errors identified in generated files which I don’t understand and I’d love some insight.

I’m having issues with dotnet and packages at the same time and I’m not sure whether it’s affecting the build or not. I answered a post here with details.

(I replaced the name of the project with ****)

The errors :

Intermediate\Build\Win64\UnrealEditor\Inc\****\UHT\Pickup.generated.h(65): error C2951: template declarations are only permitted at global, namespace, or class scope
Intermediate\Build\Win64\UnrealEditor\Inc\****\UHT\Pickup.generated.h(65): error C2988: unrecognizable template declaration/definition
Intermediate\Build\Win64\UnrealEditor\Inc\****\UHT\Pickup.generated.h(65): error C2143: syntax error: missing ';' before '<'
Intermediate\Build\Win64\UnrealEditor\Inc\****\UHT\Pickup.generated.h(65): error C2071: 'StaticClass': illegal storage class
Intermediate\Build\Win64\UnrealEditor\Inc\****\UHT\Pickup.generated.h(65): error C2059: syntax error: '<'
Source\****\Actors\Pickups\Pickup.cpp(12): error C2027: use of undefined type 'APickup'
Source\****\Actors\Pickups\Pickup.h(12): note: see declaration of 'APickup'

This is followed by errors related to Pickup which seem to just be a consequence of the prior issue. (I can add them if needed)

I tried to delete the intermediate folder and rebuild everything, but it didn’t work. The error appeared out of the blue without me making any change to this class specifically.

Here’s everything just in case :

The line which seems to be the issue in the generated file :

template<> ****_API UClass* StaticClass<class APickup>();

.h

#pragma once

#include "CoreMinimal.h"

#include "Pickup.generated.h"

UCLASS(Blueprintable)
class ****_API APickup : public AActor
{
	GENERATED_BODY()

public:    
    APickup();    

protected:    
    virtual void BeginPlay() override;

    virtual void SetupOverlap();

    void ApplyEffects(AActor* Actor);

    UFUNCTION()
    void OnSphereBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

    UPROPERTY(EditAnywhere)
    class USceneComponent* SceneRootComponent{ nullptr };
    UPROPERTY(EditAnywhere)
    class USphereComponent* SphereComponent{ nullptr };
   
    UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Pickup")
    TArray<TSubclassOf<class UGameplayEffect>> PickupEffects;
};

.cpp

#include "****/Actors/Pickups/Pickup.h"

#include "Components/SphereComponent.h"
#include "Components/SceneComponent.h"

#include "****/AbilitySystem/Utility/NWkGASUtility.h"
#include "****/Characters/PlayerCharacter/PlayerCharacter.h"
#include "****/AbilitySystem/NWkAbilitySystemComponent.h"

APickup::APickup()
{
    PrimaryActorTick.bCanEverTick = false;

    SceneRootComponent = CreateDefaultSubobject<USceneComponent>(FName("Root"));
    RootComponent = SceneRootComponent;

    SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent"));
    SphereComponent->SetupAttachment(RootComponent);
    SphereComponent->SetSphereRadius(100.f);
    SphereComponent->SetGenerateOverlapEvents(true);    
}

void APickup::BeginPlay()
{
    Super::BeginPlay();

    SetupOverlap();
}

void APickup::OnSphereBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    ApplyEffects(OtherActor);

    Destroy();
}

void APickup::SetupOverlap()
{
    SphereComponent->OnComponentBeginOverlap.AddDynamic(this, &APickup::OnSphereBeginOverlap);
}

void APickup::ApplyEffects(AActor* Actor)
{
    if (!Actor)
        return;

    APlayerCharacter* playerCharacter = Cast<APlayerCharacter>(Actor);
    if (!playerCharacter)
        return;

    UNWkAbilitySystemComponent* playerASC = playerCharacter->GetNWkAbilitySystemComponent();
    if (!playerASC)
        return;

    for (TSubclassOf<UGameplayEffect> Effect : PickupEffects)
    {
        NWkGASUtility::ApplyGameplayEffectToSelf(playerASC, Effect, this);
    }
}