"LogWindows:Error: WindowsGetLastError: The operation completed successfully." Error - how do I solve this?

Whenever I put some code before the ‘UCLASS()’ declaration in a .h file, this error occurs and Visual Studio underlines ‘UCLASS()’ with the unhelpful message ‘This declaration has no storage class or type specifier’. Currently I’m trying to create an enum, however this error occurs every time I add extra code before the class declaration.

Enemy.h

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

#pragma once

#include "GameFramework/Character.h"
#include "Enemy.generated.h"

UENUM(BlueprintType)
enum class EState : uint8
{
	ESTATE_Idle		UMETA(DisplayName = "Idle"),
	ESTATE_Moving	UMETA(DisplayName = "Moving")
};

UCLASS()
class MYGAME_API AEnemy : public ACharacter
{
	GENERATED_BODY()

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

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

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

	// Create variables
	UPROPERTY(EditAnywhere)
	int32 MaxHealth;
	int32 AttackDamage;
	int32 AggroRange;
	int32 AttackRange;
	int32 MovementSpeed;
	float TurnSpeed = 5.f;

	int32 Aggro;
	bool bIsAlive = true;
	int32 CurrentHealth = 100;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	EState State = Idle;

	// Create functions
	void TakeDmg(int32 Damage);
	int32 CheckForAggro(int32 Aggro, int32 AggroRange);
	void Attack(int32 PlayerCode);
	void TakeAttack(int32 Damage);

	FRotator GetRotationToPlayer(int32 PlayerCode);
	FVector2D GetVector2DToPlayer(int32 PlayerCode);
};

How do I get rid of this error? Is it to do with the enum, and if so how do I correctly create an enum? If not, I’ve also tried coding a ‘UUserDefinedEnum’ that would be included as a header file, what is the correct syntax for creating one of these?

Thanks in advance