UBoxComponent - undeclared identifier

Hi,

I’m new to unreal. I’m following a tutorial and seem to have failed at the first compile attempt.
I’m getting a few errors but I suspect they are all related to the UBoxComponent - undeclared identifier.
It feels like I’ve forgetten to include something as when I’m typing in Visual Studio UBoxComponent never appears as an 'autofill option.

I’ve pasted the code below and would appreciate any help / tips.

I’m using Unreal 4.16.2 on a PC

header file

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

#pragma once

#include “CoreMinimal.h”
#include “GameFramework/Pawn.h”
#include “RunnerController.generated.h”

UCLASS()
class TUTORIAL_RUNNER_API ARunnerController : public APawn
{
GENERATED_BODY()

public:
// Sets default values for this pawn’s properties
ARunnerController();

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;

UPROPERTY(EditAnywhere)
	UShapeComponent* CollisionBox;

UPROPERTY(EditAnywhere)
	float Speed = 100.0f;

UPROPERTY(EditAnywhere)
	float SwitchSpeed = 300.0f;

void OnSwitch();
void OnRestart();

bool Switched = false;

};

cpp file:

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

#include “RunnerController.h”
//#include “RunnerSwitcher.h”

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

CollisionBox =  CreateDefaultSubobject< 
	UBoxComponent>(TEXT("Root"));
CollisionBox->bGenerateOverlapEvents = true;

AutoPossessPlayer = EAutoReceiveInput::Player0;

}

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

}

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

FVector NewLocation = GetActorLocation();
NewLocation.Y += Speed * DeltaTime;
NewLocation.Z += SwitchSpeed * DeltaTime * (Switched ? 1 : -1);

if (NewLocation.Z > 70.0f) NewLocation.Z = 70.f;
else if (NewLocation.Z > 420.0f) NewLocation.Z = 420.0f;

SetActorLocation(NewLocation);

}

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

InputComponent->BindAction("Switch", IE_Pressed, this, &ARunnerController::OnSwitch);

}

void ARunnerController::OnSwitch()
{
Switched = !Switched;

}

try including: “Components/BoxComponent.h”.
You can find those by going to the api reference and looking at the bottom (UBoxComponent | Unreal Engine Documentation)

yeah, for starters, every time that you have something like this or you have the header but not the source, try to find the class name in the documentation, you will see in the bottom, the proper header and also the proper module, including that is enough 99% of the cases

here your example
Capture.PNG

For some reason, Unreal was working fine on Sunday and Monday. Then windows updates and visual studio update, then the same projects previously used uboxcomponent and did not require the header file. Now is is undeclared/undefined and needs the header file. For some reason, even loading the previous version 4.14.3, the header file is required. I do not know why the included files are now changed. In the previous compile, engine.h was included, now the Unreal Engine, when creating a new C++ Class, adds in <#include “CoreMinimal.h”> instead of <#include “Engine.h”> in the main header file. I am confused as to why it suddenly shifted. I got it to compile by adding the uboxcomponent.h header file, but it is still strange that I would have to add it when I did not have to before.