【发布时间】:2017-11-17 08:04:58
【问题描述】:
我正在使用 Unreal Engine 4.16 和 Visual Studio 2017,我正在尝试导入一个类:“PhysicsEngine/PhysicsHandleComponent.h”,但出现很多错误。
如果我不导入它,一切正常,构建正确,一切正常,所以问题被隔离了。
在头文件 Grabber.h 中,在包含之前,我有这个:
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Grabber.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UGrabber : public UActorComponent
{
GENERATED_BODY()
...
一切正常。
但只要我包含正确的标题,就像这样:
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "PhysicsEngine/PhysicsHandleComponent.h"
#include "Grabber.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UGrabber : public UActorComponent
{
GENERATED_BODY()
...
“UCLASS”(第 10 行)和“class”(第 11 行)加下划线,不会生成任何内容,并且会引发以下错误:
E0077 this declaration has no storage class or type specifier ...\Grabber.h 10
E0065 expected a ';' ...\Grabber.h 11
为什么不让我导入这个文件?
编辑:这是正确的文件,正确的拼写,它是引擎中的一个文件。不是我写的,所以“PhysicsEngine/PhysicsHandleComponent”没有错
【问题讨论】:
-
这个链接有帮助吗,尤其是最后一个帖子? answers.unrealengine.com/questions/197994/…
标签: c++ header-files unreal-engine4