Guys, can someone tell me, are you actually getting a compiler warning/error about including Engine.h? I’ve added the following to my Build.cs files:
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bEnforceIWYU = true;
I’m getting the new behaviour (no module PCH used) but I can still include Engine.h and use GEngine without issue. Wondering what I’m missing?
Also, confused by 's solution. The GEngine pointer is declared in the same header as the UEngine class, so if you can’t include that header, then creating another extern declaration won’t help because without the class definition, you can’t access any members or methods anyway. The fact there are two Engine.h files doesn’t help much (Engine/Classes/Engine.h and Engine/Public/Engine.h). The former includes the class and GEngine, but it’s the latter that is the monolithic header which presumably we’re no longer supposed to be including.