生成 Actor 时出现大量错误 (Unreal Engine 4)
Plethora of errors upon generating an Actor (Unreal Engine 4)
前几天刚开始进入 unreal engine,但是当我尝试从编辑器创建新演员时,我立即在 Visual Studio 中遇到错误。
我根本没有更改任何代码,但我收到 87 个错误。
Here is a picture of some of the errors.
我已经在下面发布了我的两个演员文件,并冒昧地在任何带有错误下划线的行旁边发表评论。这是我对代码所做的唯一更改。
这是我的 'MyActor.h' 文件。
// 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;
};
这是我的 'MyActor.ccp' 文件。
// 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'
}
在做了一些研究后,我假设这是引擎的某种设置问题,我不知道该怎么做。如有任何帮助,我们将不胜感激!
很可能大多数错误在其他帖子中都有具体的答案,但要关注 "plethora" 问题:
- 不要惊慌。
- 首先选择一种错误类型进行排序。当你犯了很多错误时,他们往往会成群结队地狩猎。
- 确定错误的优先级。例如,如果它以 "cannot find file" 开头,您可能会遇到许多相关错误,例如 blah 未定义。修复 include 目录,或者忘记 include 和类似的可能会消除其他几个错误。
- 有些错误是由拼写错误或缺少分号引起的。仔细阅读错误并查看被调用的行。您可能会发现一些东西,或者意识到前面的行缺少分号或大括号或导致后续级联问题的东西。
- 如果您收到智能感知提示的内容或作为警告,也请阅读。这可能会让您对潜在问题有另一种看法。
- 不要惊慌。我已经说过了,但是一次选一个,但要优先考虑。
- 定期编译小的更改,而不是花几个小时编写代码,然后通过游戏一次性解决所有问题。这一点都不好玩。
前几天刚开始进入 unreal engine,但是当我尝试从编辑器创建新演员时,我立即在 Visual Studio 中遇到错误。
我根本没有更改任何代码,但我收到 87 个错误。
Here is a picture of some of the errors.
我已经在下面发布了我的两个演员文件,并冒昧地在任何带有错误下划线的行旁边发表评论。这是我对代码所做的唯一更改。
这是我的 'MyActor.h' 文件。
// 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;
};
这是我的 'MyActor.ccp' 文件。
// 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'
}
在做了一些研究后,我假设这是引擎的某种设置问题,我不知道该怎么做。如有任何帮助,我们将不胜感激!
很可能大多数错误在其他帖子中都有具体的答案,但要关注 "plethora" 问题:
- 不要惊慌。
- 首先选择一种错误类型进行排序。当你犯了很多错误时,他们往往会成群结队地狩猎。
- 确定错误的优先级。例如,如果它以 "cannot find file" 开头,您可能会遇到许多相关错误,例如 blah 未定义。修复 include 目录,或者忘记 include 和类似的可能会消除其他几个错误。
- 有些错误是由拼写错误或缺少分号引起的。仔细阅读错误并查看被调用的行。您可能会发现一些东西,或者意识到前面的行缺少分号或大括号或导致后续级联问题的东西。
- 如果您收到智能感知提示的内容或作为警告,也请阅读。这可能会让您对潜在问题有另一种看法。
- 不要惊慌。我已经说过了,但是一次选一个,但要优先考虑。
- 定期编译小的更改,而不是花几个小时编写代码,然后通过游戏一次性解决所有问题。这一点都不好玩。