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"

#include (still) breaks Generated_Body()

I want to bump an issue that has been in the engine for years** but that has become especially problematic since the IWYU system got shipped. Basically, you can only add as many #includes as you have blank lines above #include "filename.generated.h". If you mess with the lines above the UClass statement in any other way, you get an error saying that Generated_Body() 'has no storage class or class specifier'.

Now, there is a workaround. If you compile in the editor, then refresh the VS project and then reload/reopen the project, the error goes away. Still, it's annoying to have to jump through this hoop every time you want to include something (not to mention, it's frustrating and confusing to people who are new to the engine). I believe this issue got marked as solved, but the problem lingers.

**Since 4.8 according to this thread: https://answers.unrealengine.com/questions/244074/adding-additional-includes-breaks-my-class.html

Product Version: UE 4.18
more ▼

asked Nov 27 '17 at 10:24 PM in C++ Programming

avatar image

16 1 1 2

avatar image TAN_ Mar 01 '18 at 07:17 AM

I second this. I just tried with 4.18.3 and it still is the same.

avatar image Atheist91 Mar 01 '18 at 11:07 AM

I separate a lot of stuff with blank lines in my headers. Includes are one of these things and I never had such issue.

Could you provide some example code that causes it?

avatar image Blood_Jackal1992 Mar 21 '19 at 05:24 PM

As someone who has more experience in Unity, I have to say that Unreal's C++ doesn't make things easy in the very least.

I found out that the error is caused by literally moving the GENERATED_BODY() macro to a different line (at least that's what I've noticed) which is mind-boggling to say the least. And the funny thing is that compilation is never consistent with this kind of error. Sometimes it compiles anyway, other times it gives me an error, which is another bundle of weirdness.

My advice is not to move the GENERATED_BODY() to a different line from what it was originally at

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

0 answers: sort voted first
Be the first one to answer this question
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