Hi,
Sorry if this question was resolved because I read many similars posts but I still can’t resolve my issue (I’m new to Unreal Engine 4).
When I’m declaring my UStruct in the header file of a custom class, the compilation failed on the line GENERATED_BODY() of the UStruct (even with the ~.generated.h file inclued) with the message : “the declaration has no storage class or type specifier”.
When I remove the Ustruct declaration, the compilation works.
Here is my code :
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "Room.generated.h"
USTRUCT(BlueprintType)
struct MyStruct {
GENERATED_BODY() // Here is the error
UPROPERTY()
float structVar;
};
UCLASS(Blueprintable, Abstract)
class HACK_N_SLASH_C_API ARoom : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ARoom();
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float testVar;
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
};
I work with Unreal Engine 4.12 and Visual Studio 2015. Nothing changes with many cleans and builds.
How can I declare my Ustruct ?