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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Problem to create a struc

Hello,

In my project, i cannot create a simple ustruct even if I copy/paste an existing and functional struct from an other file: it always fails to build. More precisely, the "GENERATED_USTRUCT_BODY" is always underlined with the error message "this declaration has no storage class or type specifier". And the first thing after that is marked as "expected ;" Here is the code of my header (but this problem occurs everywhere) :

 #pragma once
     #include "GameFramework/PawnMovementComponent.h"
     #include "MyMovementComponent.generated.h"
     
     USTRUCT()
     struct MyStruct
     {
         GENERATED_USTRUCT_BODY()// underlined with "this declaration has no storage class or type specifier"
     
         UPROPERTY()
             float f; // f is marked with "expected ;"
     
         MyStruct(){
         };
     };
     
     UCLASS()
     class PROTOGAMEPLAY_API UMyMovementComponent : public UPawnMovementComponent
     {
         GENERATED_UCLASS_BODY()
         
     };

As you can see, i have not forget the .generated.h, so i don't understand from where this error comes. To finish, i work with UE 4.5.

Thank you in advance.

Product Version: Not Selected
Tags:
more ▼

asked Oct 30 '14 at 09:36 PM in C++ Programming

avatar image

Venturix
6 3 4 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

After a cleaning and a rebuild of my project, I managed to launch it but the false error that I described is always there. That's weird and annoying but if it works... Problem solved. (If someone knows how to solve that, I would be happy to know)...

more ▼

answered Oct 31 '14 at 12:45 AM

avatar image

Venturix
6 3 4 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The constructor for the struct shouldn't have the last ";". Here is an working example:

 USTRUCT()
 struct FTest
 {
     GENERATED_USTRUCT_BODY()
 
     UPROPERTY()
     bool bVariable;
 
     FTest() {}
 };
more ▼

answered Oct 30 '14 at 09:45 PM

avatar image

xlar8or
6k 161 129 304

avatar image Venturix Oct 30 '14 at 11:15 PM

Thanks for your rapid answer,

Effectively i forget that ; but that's not the origin of the problem. Maybe an include or someting else, or UE itself? (I'll try to reinstall it)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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