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 name.eg 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.
5/5

Welcome to our audio and rhythm plugins collection! With MidiEngine, you can easily import MIDI files and use midi events to create engaging rhythm gameplay or enhance your videos.

4.5/5

Plugin that helps add UMG Widgets to Level Sequences for Text Layers, Movie Titles, 2D layers and more… directly within sequencer. Cross platform.

5/5

Let your end users Split And Resize The UI at runtime. Perfect for both games and Applications.

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!