#Include “Engine.h” Monolithic headers should not be used UE5 Warning

We will cover the alternative to using #include “Engine.h” in this tutorial. Whenever you use the global variable GEngine , you might encounter the error “Use of undeclared Identifier GEngine”.

You may then think the solution is to #include “Engine.h” , which works during development but will lead to plugins failing to package with the following warning: ” Monolithic headers should not be used by this module. Please change it to explicitly include the headers it needs “.

The Alternative to "Engine.h"

There are multiple headers that include the definition for GEngine and one of them is the “Runtime\Engine\Public\Engine.h” 

and this is not what we want. 

The header to include in this case is:  #include “Engine/Engine.h”

Don’t get confused by the two, they are not the same although they are both Engine.h. Epic Games explained it better when they introduced their Include What You Use model , or IWYU , which you should read about. In that article they mention the best way to use GEngine under this model.