Compilation error - CoreMinimal.h / Engine.h

I have been following the video, and trying to define ATriggerVolume* PressurePlate. The script cannot compile initially and threw some errors regarding that line.

The version of Unreal I used (4.16) only has #include “CoreMinimal.h”, which is to speed up the build time as mentioned by an Unreal staff. He mentioned that we should include specific header files when needed. Link to Unreal post

I managed to fix the compilation error by #include “Engine.h”, as is present in the version of Unreal used in the video. With some digging around, I also found out that #include “Engine/TriggerVolume.h” will work as a lighter weight solution, rather than including the whole engine.

I am wondering for future videos, would it be possible to specify which header files contain the Unreal macros/classes that we are using in the video? And may be a brief overview of Unreal engine header files.

3 Likes

I been telling people to please include “CoreMinimal.h” and “Engine.h” if you want to be able to follow along with the lecture. Yes, including “Engine.h” will make building your code longer, but for every types, macros, etc… there should always be a source files if you look them up on UE4. One more thing you can only build one-time for this so get the things you need, look it up, and find the header file.

For example:

LineTraceSingleByChannel()

You don’t have to include “Runtime/Engine/Classes/Engine/World.h” only “CoreMinimal.h”, but including “Engine.h” allows you to have access to the drop-down menu you see during the lectures. If that’s how you would like to learn make it that way or if you prefer just add “CoreMinimal.h” and the require headers later on if it’s “LineTraceSingleByChannel” just add #include “World.h” makes the building much faster and don’t forget to omit out “Engine.h” on your final projects.

Privacy & Terms