Search code examples
c++intellisenseunreal-engine4

Plethora of errors upon generating an Actor (Unreal Engine 4)


Just started getting into the unreal engine the other day, but when I tried to create a new actor from the editor I got errors right away in Visual Studio.

I have not changed any of the code at all yet I receive 87 errors.

Here is a picture of some of the errors.

I have posted my two actor files below and taken the liberty of commenting next to any line that has been underlined with an error. This is the only change I have made to the code.

Here is my 'MyActor.h' file.

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"  //Red underline under '#include'

UCLASS()  //Green underline under 'UCLASS'
class BIGFEET_API AMyActor : public AActor
{
    GENERATED_BODY()  //Red underline under 'GENERATED_BODY'

public: 
    // Sets default values for this actor's properties
    AMyActor();

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

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



};

Here is my 'MyActor.ccp' file.

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

#include "MyActor.h"


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

}

// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
    Super::BeginPlay();  //Red underline under 'BeginPlay'

}

// Called every frame
void AMyActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);  //Red underline under 'Tick'

}

I am going to assume this is some sort of setup issue with the engine after doing some research I have been left clueless as what to do. Any help would be appreciated!


Solution

  • The chances are most of the errors have specific answers in other posts, but to focus on the "plethora" issue:

    1. Don't panic.
    2. Pick one type of error to sort first. They tend to hunt in packs when you get lots of errors.
    3. Prioritise the errors. For example if it starts by saying "cannot find file", you will probably get many related errors, like blah is undefined. Fixing the include directories, or forgotten includes and similar might get rid of several other errors.
    4. Some errors are caused by typos or missing semi-colons. Read the error carefully and look at the line that is being called out. You may spot something, or realise the line before has a missing semicolon or brace or something which causes a subsequent cascade of problems.
    5. If you get things called out by intellisense or as warnings, read that too. This may give you another persepcitve on the underlying problem.
    6. Don't panic. I said that already, but pick these off one at a time, but prioiritise.
    7. Compile small changes regularly rather than spending hours writing code then playing hunt the problems all in one go. It's no fun.