Error: UnrealHeaderTool failed for target 'ProjectName'

This error occurs on a consistent basis, and I can’t really pinpoint why. I started a new project yesterday where I added a struct and two enums, and somewhere in between that, compiling started failing. However, I outcommented or even removed every change I’ve done to the .cpp and .h, and this error still occurs.

cpp



#include "PlayerCharacter.h"


// Sets default values
APlayerCharacter::APlayerCharacter()
{
     // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = false;


}

// Called when the game starts or when spawned
void APlayerCharacter::BeginPlay()
{
    Super::BeginPlay();

}

// Called every frame
void APlayerCharacter::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

}

// Called to bind functionality to input
void APlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

}


h



#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "PlayerCharacter.generated.h"

/*
USTRUCT()
struct FUserStats
{
    GENERATED_BODY()

    UPROPERTY()
    float Health;

    UPROPERTY()
    TArray<bool> ConditionFlags;
};

/*
UENUM(BlueprintType)
enum class ECharacterConditions : uint16
{
    CC_SLEEPING            UMETA(DisplayName="Sleeping"),
    CC_RUNNING            UMETA(DisplayName="Running"),
    CC_LAST_INDEX        UMETA(DisplayName="IndexCount")
};

/*
UENUM(BlueprintType)
enum class ECharacterHealth : uint8
{
    CH_DEAD                UMETA(DisplayName = "Dead"),
    CH_ALIVE            UMETA(DisplayName = "Alive"),
    CH_LAST_INDEX        UMETA(DisplayName = "IndexCount")
};
*/

UCLASS()
class APlayerCharacter : public ACharacter
{
    GENERATED_BODY()


    //UPROPERTY(VisibleAnywhere, Category = "PlayerStats")
    //UPROPERTY()
    //FUserStats PlayerStats;

    // UTILS //
public:
    // Sets default values for this character's properties
    APlayerCharacter();


protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:    
    // Called every frame
    virtual void Tick(float DeltaTime) override;

    // Called to bind functionality to input
    virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;



};


Intellisense also complains about GENERATED_BODY(), but not sure if that one is actually important.
Also, forgot to mention, if I restart the VS17 and the editor, it allows me to compile. I am running as admin.

Does cleaning the project in VS and recompiling work? Certain changes will give me errors until I build from scratch.

I’ll test it later or tomorrow. I’m not home at the moment, but thanks for the tip!

Error: UnrealHeaderTool failed for target ‘AbilitySystemEditor’ (platform: Win64, module info: E:\Users\Documents\Unreal Projects\AbilitySystem\Intermediate\Build\Win64\AbilitySystemEditor\Development\AbilitySystemEditor.uhtmanifest, exit code: OtherCompilationError (5)).

I get this error even when im just creating a new c++ project, it wont even open, instead wants me to open in VSCode.