GENERATED_BODY() - this declaration has no storage class or type specifier

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!

Oh man. This was it. Actually I added GENERATED_BODY() inside the class code myself. The problem wasn’t the struct but the class instead. Thanks!

if problem is solved - mark as answer to close the topic

But there are “0 answers”…

TerrainNoiseGenerator hasn’t parent class

Now it is :slight_smile:
When comment becomes a answer you can convert your comment to answer, then it can be marked as resolved by question maker.

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.

Hi,
sorry what does the answer mean? I have the exact same situation, but nothing here explains the problem or the solution.

Hey, XSheim
Remove, won a Work //

> #include "CoreMinimal.h"

remove on cpp And .h Working on my Project ,Try that

GENERATED_BODY() error:"this declaration has no storage class or type specifier"

Dont, Worry Listten and follow the Steps

  1. Go to the UE4.C++ class in the .h file who GENERATED_BODY() error find that
  2. in the Header, Attach them (#include “CoreMinimal.h”) the Include But, Only .h file And use one Times
  3. 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
  4. 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"