Question about the includes

There is something about the includes I don’t understand. Since in the OpenDoor.cpp the OpenDoor.h is included, it means that everything in the header file is “pasted” into the .cpp file. Earlier we had to include the
"GameFramework/Actor.h" header file, but I can only inlcude it in the .cpp file. Why is it?
In this section we have to include in the DoorOpen.h the “Engine/TriggerVolume.h” file, but the code only compiles, when the includes are in a specific oreder and if there is only one line between the includes and the
line which starts with “UCLASS”. Is it some Unreal related “bug”? Or is there some other explanations?

1 Like

Hi Daniel_Toth

Agreed with your statement and would like to add something to exactly why the header files are placed in order for the compilation to take place without all the errors, from the squiggly lines from appearing!

To ben Sam and the rest of the Udemy team!

These are my errors, I keep on getting these red squiggly lines within my two documentations for Positionreport classes. It’s strange because when I compile this part of the program, it compiles - however it only shows one of the objects being called to be displayed in the output log, even though I have got two objects in the scene!

Also I think there seems to be an awful lot of confusion where exactly the header files are supposed to be placed, Sam had said in Section 3, Lecture 63 Accessing ObjectNames that #include "GameFramework/Actor.h was to be used and I quote “At the top of the C++ file.” unquote - which file is Sam referring to. the header file or the implementation file. This needs to be addressed where any #include header files are to be declared for future reference, can that be looked into as a matter or priority?

For Daniel_Toh if you are still getting the errors save your work, close down everything, re-boot the laptop/Desktop PC and re-open Epic Games, Unreal Engine and see if that works, if that doesn’t work don’t know what to suggest. Mine compiles but it only shows one object that’s being called in the output log, even though I have got two objects in the scene that can be seen!

Hope that helps, Brandon

Thanks for your answer Brandon. If I got the sequences of the header files right, the code compiles.
I asked one of my friend who has more experience with c++ and he said, that in fact the sequence of the header files does matter. He said something like broader the content of the header file is, the upper it should be.

1 Like

Privacy & Terms