Difference between EngineMinimal.h and Engine.h?

So I just spent a lot of time trying to find out why my UProjectileMovementComponent couldnt be found by the compiler, it kept telling me the following error:

Error: identifier “UProjectileMovementComponent” is undefined
error C2065: 'UProjectileMovementComponent ': undeclared identifier
error C2923: ‘TSubobjectPtr’: ‘UProjectileMovementComponent’ is not a valid template type argument

And after some searching I found out that I had to change the #include “EngineMinimal.h” to #include “Engine.h”

What’s the difference between those two?

I know its late for you, but this was the first result in Google so I’ll answer in case anyone else comes looking like I did.

Engine.h is a superset of EngineMinimal.h (in that Engine.h includes EngineMinimal.h), but Engine.h loads far more files that EngineMinimal.h.

If you have access to GitHub, you can view both files:

EngineMinimal.h: Engine/Source/Runtime/Engine/Public/EngineMinimal.h

Engine.h: Engine/Source/Runtime/Engine/Public/Engine.h

If you’re having dependency issues, it’s probably safer to just use Engine.h.

Thank you.

EngineMinimal is designed to be included in your PCH. I seem to always need to include it or I get compile errors in engine code (possibly because Unreal code is expecting it or requires specific include ordering?).

Engine.h is huge and including it will probably slow down your compile. It’s better to include the headers for the functionality you’re using (include Actor.h when creating Actors or ProjectileMovementComponent.h when using UProjectileMovementComponent).

Comment from EpicJamesG:

All UE4 templates now only include headers they need, rather than Engine.h. Much faster initial compile!

After discussion, added EngineMinimal.h. Includes commonly-used engine headers, add to your PCH.