虚幻引擎5 C++ -初始化类不起作用

bnlyeluc  于 2023-05-20  发布在  其他
关注(0)|答案(1)|浏览(188)

嘿,我目前正试图调试我的游戏,但每当我尝试我得到以下错误:“语法错误:missing ';' before '*'“-> line 30 of my code and“missing type specifier - int assumed.注意:C++不支持default-int”-> line 30“以及“unexpected token(s)preceding ';'”->也在第30行
我的代码看起来像这样:

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

#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "GameFramework/SaveGame.h"
#include "MyDataConfig.h"
#include "AbilityConfig.h"
#include "QuestsConfig.h"
#include "PlayerHUDCpp.generated.h"

UCLASS()
class WOWFAKECPP_API UPlayerHUDCpp : public UUserWidget
{
    GENERATED_BODY()


public:

    bool target = false;
    int DisplayedQuest = 0;
    bool QuestOpen = false;
    //FString accept = "Accept";

    UQuestsConfig* MyQuestConfig;
    UMyDataConfig* MyDataConfig;
    UAbilityConfig* MyAbilityConfig;

最后一行是第30行。如您所见,“UAbilityConfig* MyAbilityConfig;“工作,但最后不...
我试图清理项目,删除“保存”和“中间”文件夹,并restartet我的电脑多次,但他们似乎都没有工作,因为只要我尝试调试项目,我得到的错误,我上面显示我不知道我应该做什么了,请帮助我。

falq053o

falq053o1#

如果这是该文件的“所有代码”,那么显然缺少了结尾括号}
它应该看起来像这样:

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

#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "GameFramework/SaveGame.h"
#include "MyDataConfig.h"
#include "AbilityConfig.h"
#include "QuestsConfig.h"
#include "PlayerHUDCpp.generated.h"

UCLASS()
class WOWFAKECPP_API UPlayerHUDCpp : public UUserWidget
{
    GENERATED_BODY()


public:

    bool target = false;
    int DisplayedQuest = 0;
    bool QuestOpen = false;
    //FString accept = "Accept";

    UQuestsConfig* MyQuestConfig;
    UMyDataConfig* MyDataConfig;
    UAbilityConfig* MyAbilityConfig;
}

相关问题