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"

Single empty c++ line influences compile result

I have started creating a C++ Environment Query System test. For testing purposes, I added a struct in "EnvQueryTypes.h" (in the engine folder of the project), then removed it afterwards. The single difference after the deletion of the new struct was a single, empty line (I made sure to use a text diff tool with the original version). Whenever I had a fresh C++ test in my project, the compiling results in errors. When I didn't have a C++ EQS test in my project, the scenario of the first screenshot compiles as well.

Screenshot (look at line 452, added empty line) after re-build of the solution https://gyazo.com/edffbed87d8313a1136882f64f4e396d

Screenshot (look at line 452, removed the empty line) after re-build of the solution https://gyazo.com/541556278b41fd79dbd5261a265d52ea

Sadly I can't test for reproduction right now, since I would have to re-download the engine, since engine code is shared among projects.

How is it possible that a single empty line affects compiling results?

Product Version: UE 4.16
more ▼

asked Jul 10 '17 at 08:43 PM in Bug Reports

avatar image

84 6 12 17

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

1 answer: sort voted first


It's hard to tell from the information you have provided, but at a guess, UnrealHeaderTool hasn't rerun for some reason. Perhaps if you added and removed the line while UnrealHeaderTool was running, it would get confused with the timestamps of the generated code and not rerun.

But the reason for the errors is that the .generated.h header contains line references to the reflection macros in the .h file. GENERATED_BODY(), for example, can be specified multiple times for different classes/structs in the same header, but the macro needs to expand to the right struct-specific code in each case, and this disambiguation is done by the line number of the macro. So if the .generated.h doesn't match the .h, it will result in these kind of compile errors.

Hope this is clear,


more ▼

answered Jul 11 '17 at 10:38 AM

avatar image

Steve Robb STAFF
2.8k 58 31 101

avatar image Quexlaw Jul 11 '17 at 12:08 PM

So specific lines including line number are taken into account in the generated.h headers, I see, thank you.

But then, how do I rerun the UnrealHeaderTool?

avatar image Steve Robb STAFF Jul 11 '17 at 12:13 PM

You should just be able to make a trivial change to the header (add a space, delete it, save) then build again, and the build tool should notice that the header is out-of-date and rerun UnrealHeaderTool.


avatar image Quexlaw Jul 11 '17 at 12:28 PM

This doesn't work. That's how I've reproduced the problem in my file too. If I add a line somewhere, those errors get thrown around. It wasn't a "one-time-thing"; if I add a line, I get errors. Maybe it's the generated.h file itself that should be regenerated completely? If so, how do I do that?

avatar image Steve Robb STAFF Jul 11 '17 at 12:36 PM

When you make the change, do you see UnrealHeaderTool run?

It could also be that your header from a module which you don't have a dependency on. If the module is not a dependent of your project, then changes to it will be ignored when you build your project.


avatar image Quexlaw Jul 11 '17 at 12:41 PM

Ah, I do not see the UnrealHeaderTool being run after having made the change. That does explain why the generated.h isn't being updated accordingly. Also, my project does have the dependency necessary for using it included.

It could be that I once by mistake editted the generated.h file; could this be responsible?

avatar image Steve Robb STAFF Jul 12 '17 at 10:44 AM

It should be enough that the .generated.h file has an older timestamp than the .h file, or doesn't exist at all. You can try deleting it and building and see it gets built.

If you find and open the .uhtmanifest file for your project+config then it will tell you which headers are being considered for being rebuilt. The file is in compressed JSON format - you should be able to search for the name of your header in any normal text editor, but you might want to use a JSON formatter if you actually want to read 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