The #include "DrawDebugHelpers.h"

Why does the #include “DrawDebugHelpers.h” need to be included in the CPP file instead of the header file?
Everytime I stuck it in my header file, it threw everything off i.e. GENERATED_BODY() started getting errors (no matter where I put the new include).

Also why do new includes sometimes cause errors with GENERATED_BODY()?

Thanks.

PS. Would be great if they updated the course with more texts/step in videos to show what includes are needed now (and where to put them).

2 Likes

I always added the libraries in the .h file, from up top. So that generated stays at the bottom. I don’t know what caused those issues but my thinking is that because they are macros, VS can’t understand them but Unreal can. So compiling with those red lines don’t hurt anyone.

I didn’t have to include it at all for this lesson. Did I miss something?

It’s for the next one If I remember correctly

I had the same issue where I put the #include “DrawDebugHelpers.h” in the header file, but it gave me errors on a few of my .h Macros. Then when I tried to build it I got about 15 other errors across the .h and .cpp file. Quit without saving and reloaded grabber and put the #include “DrawDebugHelpers.h” in the .cpp file and everything is fine.

I read on " https://stackoverflow.com/questions/3943352/where-to-put-include-statements-header-or-source " that you should only include things in the header file if the .h file itself needs them.

Would be cool to know if this is fine or if I’m going to have any issues down the road?

The always forget to include the header files

Privacy & Terms