Hello, I have encountered a higly annoying problem while creating a struct in C++. My code:
#pragma once
#include "CoreMinimal.h"
#include "TerrainNoiseGenerator.generated.h"
USTRUCT(BlueprintType)
struct FNoiseRow
{
GENERATED_BODY() //<--- Output: "this declaration has no storage class or type specifier"
public:
UPROPERTY(BlueprintReadOnly)
TArray<float> Items;
};
class RAW_BUSINESS_API TerrainNoiseGenerator
{
GENERATED_BODY() //<--- Output: "this declaration has no storage class or type specifier"
public:
TerrainNoiseGenerator();
~TerrainNoiseGenerator();
static TArray<FNoiseRow> GenerateNoiseMap();
};
As you may have noticed, my code doesn’t compile. The output says “this declaration has no storage class or type specifier” and “missing type specifier - int assumed. Note C++ does not support default-int” What could be the reason? Maybe it’s because my class doesn’t inherit? Thanks for any help!
I also stumbled over this problem and the error was the same in the Error-list in VS. (“this declaration has no storage class or type specifier” and “missing type specifier - int assumed. Note C++ does not support default-int”).
The problem here was a slip:
I added the USTRUCT()-Definition in the .cpp-file and not in the .h - file, where it belongs.
GENERATED_BODY() error:"this declaration has no storage class or type specifier"
Dont, Worry Listten and follow the Steps
Go to the UE4.C++ class in the .h file who GENERATED_BODY() error find that
in the Header, Attach them (#include “CoreMinimal.h”) the Include But, Only .h file And use one Times
check the cpp file who link this(.h) file and ,check whether #include “CoreMinimal.h” are contain or not if not contain No,Problem else contain #include "CoreMinimal.h remove that on cpp who link this, .h file //ok, Wright there
Save All and press (Ctrl+Shift+B) or Build Script on Tap while prosessing ,Build Complete
"And Error will be gose and When other
promplem will Be showing,Please
Comment"