programming quick start - and compiler doesnt like it

The Intellisense has given up tracking down the missing include for UStaticMeshComponent, **UStaticMesh **and ConstructorHelpers. This code should still compile though since the Actor class that the class inherits from includes those.

However it is a good practice to explicitly include what you need, and you don’t have to worry about including the same thing twice since the


#pragma once

directive in the header file will ensure that everything is only included once.

Below


#include RotatingCube.h

you should add


#include "Components/StaticMeshComponent.h"

UStaticMesh is within **UStaticMeshComponent **so you don’t have to include that.

Also add


#include "ConstructorHelpers.h"

Why is it a good practice to explicitly include things you might ask?

When you don’t explicitly include things you need but expect it to magically be included somewhere else you can end up with having to sort out missing includes in a lot of places if the “magic” include suddenly doesn’t exist anymore.

The order of includes also matters so if something isn’t included until after you need it then the build will fail.

The intellisense has an easier time tracking things and you get rid of the intellisense errors.

By including it where you need it you avoid these problems.