Algosyntax Logo

UE5 Expected an include at the top of the header generated.h

UE5 expected an include at the top error

How to fix Unreal Engine Error: Expected an include at the top of the header: ‘#include “XXX.generated.h”. This is an error thrown by Unreal Build Tool when the developer has either not written the ‘include..’ line or there are spelling mistakes. Follow these steps to solve it.

Summarised Solution

  1.  Ensure the ‘#include… generated.h’ line is the last of all includes.
    The line “#include xxxx.generated.h” has to be in your header file and the last of all includes.


  2. Ensure the file name of the header and the suggested generated.h match. 

    In the line “#include xxxx.generated.h” ; xxxx has to match your header file Actor.h needs Actor.generated.h
    Resharper sometimes changes the file name when refactoring.

  3. Next Delete Intermidiate folder and regenerate project files.
    Delete the Binaries and Intermediate Folders and Regenerate project files from the uproject.

MIDI Engine 3 For UE5


Gamechanger plugin for notehighway rhythm games and music visualizers


Add Text and 2D UMG widgets to Level Sequences

Consider investing in some of our plugins. They might save you some time.  Also helps supports these tutorials.

Instantly get access to our plugins like Blender Curves Importer and UMG Cinematics and more when  you support us on Patreon!

 Join Us On Discord For More Daily Tips!