Alternative to including Engine.h

Hello everyone,

i am new to UE4 c++ programming but have some experience in c++.
To get started i am following a udemy course on c++ programming in UE4.
Unfortunately the version used is 4.10 and there have been some great changes since then.
From what i’ve learned so far big header includes have been removed to save compile time.
Unfortunately almost every function or class seems to be unknown to VS17 and the autocompletion often doesn’t work.
Including the “Engine.h” solves that issue but then I am back to including the big header file and the compiling times are very high. Is there a way to figure out what needs to be included for specific functions ?

Thanks

You use “CoreMinimal.h” and then include the headers everywhere they are needed. As an example, if you are using a UCameraComponent, you would add:

#include "Camera/CameraComponent.h"

You would do this everywhere you need to. The compiler will tell you when there is a compiling issue. When that happens, go to the docs page: [https://docs.unrealengine.com][1]

Then, search whatever you are looking for, such as, “UCameraComponent”. In the “API” tab, find the UCameraComponent page and click on it. The, scroll to the bottom of the page and it will show the module it belongs to as well as the header (.h) file location. Take the directory and file name then copy and paste as an include into the file that needs it.

Such as,

150205-capture.jpg

UE4 refers to this as “Include What You Use (IWYU)”.

If you want to enable this you’ll need to change your Build.cs to use only shared pre-compiled headers and change your include structure.

https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/IWYUReferenceGuide/