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?
asked Jul 10 '17 at 08:43 PM in Bug Reports
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,
answered Jul 11 '17 at 10:38 AM
Steve Robb STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here