x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

Product Version: UE 4.21
Tags:
more ▼

asked Dec 02 '18 at 07:50 AM in C++ Programming

avatar image

xSheim
120 4 9 16

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

TerrainNoiseGenerator hasn't parent class

more ▼

answered Dec 02 '18 at 07:58 AM

avatar image

NoCodeBugsFree
103 3 6 10

avatar image xSheim Dec 02 '18 at 08:16 AM

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!

avatar image NoCodeBugsFree Dec 02 '18 at 08:38 AM

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

avatar image S-ed Feb 04 '19 at 03:03 PM

But there are "0 answers"...

avatar image Shadowriver Feb 04 '19 at 08:20 PM

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

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question