C++ help wit .cpp and .h

Hi all, this is my second time asking a question. Thanks to all for the previous help; it worked brilliantly. I have an issue adding some code to speed up the game-level progress. I tried to add some C++ code, which Unreal opened Visual Studio, and after compiling the code and building it, I was presented with over 33 errors. I need some help. Many thanks.

Here is the code I used for a sci-fi door, file names and errors.

SciFiDoor.H

#pragma once

include “CoreMinimal.h”
include “GameFramework/Actor.h”
include “SciFiDoor.generated.h”

UCLASS()
class YOURPROJECT_API ASciFiDoor : public AActor
{
GENERATED_BODY()

public:
// Sets default values for this actor’s properties
ASciFiDoor();

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

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

// Door mesh
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UStaticMeshComponent* DoorMesh;

// Keypad mesh
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UStaticMeshComponent* KeypadMesh;

// The correct code to unlock the door
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString CorrectCode;

// The code entered by the player
UPROPERTY(BlueprintReadWrite)
FString EnteredCode;

// A flag to check if the door is unlocked
UPROPERTY(BlueprintReadWrite)
bool bIsUnlocked;

// Function to be called when a keypad button is pressed
UFUNCTION(BlueprintCallable)
void EnterDigit(FString Digit);

// Function to check the code and unlock the door
UFUNCTION(BlueprintCallable)
void CheckCode();

// Function to open the door
UFUNCTION(BlueprintCallable)
void OpenDoor();

// Function to close the door
UFUNCTION(BlueprintCallable)
void CloseDoor();

};

SciFiDoor.cpp

include “SciFiDoor.h”
include “Components/StaticMeshComponent.h”
include “GameFramework/Actor.h”
include “Kismet/GameplayStatics.h”

// Sets default values
ASciFiDoor::ASciFiDoor()
{
PrimaryActorTick.bCanEverTick = true;

// Create door and keypad mesh components
DoorMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("DoorMesh"));
RootComponent = DoorMesh;

KeypadMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("KeypadMesh"));
KeypadMesh->SetupAttachment(RootComponent);

CorrectCode = TEXT("1234");
EnteredCode = TEXT("");
bIsUnlocked = false;

}

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

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

void ASciFiDoor::EnterDigit(FString Digit)
{
EnteredCode.Append(Digit);

if (EnteredCode.Len() >= CorrectCode.Len())
{
    CheckCode();
}

}

void ASciFiDoor::CheckCode()
{
if (EnteredCode == CorrectCode)
{
bIsUnlocked = true;
OpenDoor();
}
else
{
EnteredCode = TEXT(“”); // Reset code if incorrect
}
}

void ASciFiDoor::OpenDoor()
{
if (bIsUnlocked)
{
// Add your animation or movement logic to open the door
DoorMesh->SetRelativeLocation(FVector(0, 0, 200)); // Example: Move the door up
UE_LOG(LogTemp, Warning, TEXT(“Door is now open!”));
}
}

void ASciFiDoor::CloseDoor()
{
if (!bIsUnlocked)
{
// Add your animation or movement logic to close the door
DoorMesh->SetRelativeLocation(FVector(0, 0, 0)); // Example: Move the door back down
UE_LOG(LogTemp, Warning, TEXT(“Door is now closed!”));
}
}

I get 32 errors which relate to :

Severity Code Description Project File Line Suppression State Details
Error (active) E0415 no suitable constructor exists to convert from “UPTRINT” (aka “unsigned long long”) to “UE::CoreUObject::Private::FPackedObjectRef” MyProject C:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\UObject\PackedObjectRef.h 32
Error (active) E1835 attribute “deprecated” does not apply here MyProject C:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\Serialization\BulkData.h 277
Error (active) E1835 attribute “deprecated” does not apply here MyProject C:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\Serialization\BulkData.h 1201
Error (active) E1455 member function declared with ‘override’ does not override a base class member MyProject C:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\Core\Public\Serialization\ArchiveProxy.h 157
Error (active) E1455 member function declared with ‘override’ does not override a base class member MyProject C:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\Core\Public\Serialization\ArchiveProxy.h 167
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 9
Error (active) E0020 identifier “PrimaryActorTick” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 11
Error (active) E0020 identifier “DoorMesh” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 14
Error (active) E0020 identifier “CreateDefaultSubobject” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 14
Error (active) E0254 type name is not allowed MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 14
Error (active) E0020 identifier “RootComponent” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 15
Error (active) E0020 identifier “KeypadMesh” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 17
Error (active) E0254 type name is not allowed MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 17
Error (active) E0020 identifier “CorrectCode” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 20
Error (active) E0020 identifier “EnteredCode” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 21
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 26
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 28
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 32
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 34
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 37
Error (active) E0020 identifier “EnteredCode” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 39
Error (active) E0020 identifier “CorrectCode” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 41
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 47
Error (active) E0020 identifier “EnteredCode” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 49
Error (active) E0020 identifier “CorrectCode” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 49
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 60
Error (active) E0020 identifier “DoorMesh” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 65
Error (active) E0276 name followed by ‘::’ must be a class or namespace name MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 70
Error (active) E0020 identifier “DoorMesh” is undefined MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.cpp 75
Error (active) E0070 incomplete type “YOURPROJECT_API” is not allowed MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.h 9
Error (active) E0065 expected a ‘;’ MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.h 9
Error (active) E0169 expected a declaration MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.h 48
Error Expected an include at the top of the header the follows all other includes: ‘include “SciFiDoor.generated.h”’ MyProject C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\Source\MyProject\SciFiDoor.h 1
Error MSB3073 The command ““C:\Program Files\Epic Games\UE_5.2\Engine\Build\BatchFiles\Build.bat” MyProjectEditor Win64 Development -Project=“C:\Users\adamf\OneDrive\Documents\Unreal Projects\MyProject - Copy\MyProject.uproject” -WaitMutex -FromMsBuild” exited with code 6. MyProject C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets 44

What is going on here as I am following the instruction on how to use C++ in unreals engine as I can not get a suitable door for the ship.

Thanks, and my many apologies for being such a long message but any help would be much appreciated.