【问题标题】:Plethora of errors upon generating an Actor (Unreal Engine 4)生成 Actor 时出现大量错误(虚幻引擎 4)
【发布时间】:2019-01-13 09:39:48
【问题描述】:

前几天刚开始使用虚幻引擎,但是当我尝试从编辑器创建新演员时,我在 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'

}

在做了一些研究之后,我将假设这是引擎的某种设置问题,我一直不知道该怎么做。任何帮助将不胜感激!

【问题讨论】:

  • 当您面临大量错误时,您需要决定首先要解决什么问题。我怀疑无法找到#include 文件会导致大多数其他文件。你说智能感知在“MyActor.generated.h”包含下给出了一条红线——你认为这个文件在哪里?
  • 我在 'Documents\Unreal Projects\BigFeet\Intermediate\Build\Win64\UE4Editor\Inc\BigFeet' 目录下找到了那个文件
  • 在包含路径中吗?您应该改用尖括号<> 吗?查看其他有效的演员文件并发现差异
  • 好吧,我将该目录添加到包含目录中,现在我的错误减少到 85 个,哈哈。我所有的红线错误现在也都消失了。完成后,我将继续寻找其余文件并再次发表评论。

标签: c++ intellisense unreal-engine4


【解决方案1】:

可能大多数错误在其他帖子中都有具体答案,但要关注“过多”问题:

  1. 不要惊慌。
  2. 首先选择一种错误类型进行排序。当您遇到很多错误时,他们往往会成群结队地狩猎。
  3. 优先处理错误。例如,如果它以“找不到文件”开头,您可能会收到许多相关错误,例如 blah 未定义。修复包含目录,或忘记包含和类似可能会消除其他几个错误。
  4. 一些错误是由拼写错误或缺少分号引起的。仔细阅读错误并查看被调用的行。您可能会发现一些东西,或者意识到前面的行缺少分号或大括号或导致后续问题的东西。
  5. 如果您得到智能感知或警告提示的内容,请也阅读该内容。这可能会让您对潜在问题有另一种看法。
  6. 不要惊慌。我已经说过了,但是一次选择一个,但优先考虑。
  7. 定期编译小的更改,而不是花费数小时编写代码然后一口气解决所有问题。这不好玩。

【讨论】:

    猜你喜欢
    • 2020-07-15
    • 2020-09-14
    • 2018-11-02
    • 2023-02-16
    • 2019-08-24
    • 2018-08-13
    • 1970-01-01
    • 2016-08-11
    • 1970-01-01
    相关资源
    最近更新 更多