Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 ?


  • Luuke

Product Version: UE 4.16
more ▼

asked Jun 04 '17 at 11:14 PM in C++ Programming

avatar image

15 3 4 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

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,

alt text

capture.jpg (16.8 kB)
more ▼

answered Jun 04 '17 at 11:19 PM

avatar image

466 13 11 26

avatar image HailstoneJosh Jun 04 '17 at 11:34 PM

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.


(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question