【发布时间】: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