Missing '#Pragma once'

Hello everyone,
I have a problem building solution with the LyraStartersample.

Intermediate\Build\Win64\UnrealEditor\Inc\LyraGame\LyraControllerComponent_CharacterParts.generated.h(14): fatal error C1189: #error: “LyraControllerComponent_CharacterParts.generated.h already included, missing ‘#pragma once’ in LyraControllerComponent_CharacterParts.h”
1>

I got this error after messing with source files, I deleted the project and reinstalled it and I still getting this error.

Thanks for help in advance.

3 Likes

Boy oh boy. You are the only person I’ve seen that has also had this problem. It plagued me for weeks. My issue was in LyraVerbMessage.h. The solution was to remove an #include that was not being used. Why? Idk but it fixed it. Make sure there’s no unused includes in that file its telling you about. Let me know if it works or not please.

1 Like

I`ve already double checked if there was an unused #include in both the cpp and the header files,
whats wierd about it that even on a Fresh LyraStarterSample its still does it.

I also struggled to find it.
It was hidden in an outdated .h file.
I found it by changing the .h with the #pragma once issue to another name and rebuilding.

I finally fixed it by renaming the folder which has the same name in another obsolete project.

For example, my problem is “DialogueSubtitleEditorUI.generated.h already included, missing “#pragma once” in DialogueSubtitleEditorUI.h”, and this .h file is in both “E://XXXGame//Plugins//DialogueSequencer//Source//DialogueSequencerEditor//Public” and “E://Perforce//XXX//XXXGame//Plugins//DialogueSequencer//Source//DialogueSequencerEditor//Public”. I renamed the former as “E://XXXGame//Plugins//DialogueSequencer123456//Source//DialogueSequencerEditor//Public” then rebuilt it and it finally worked!

1 Like

Faced the same issue.

In my case I missed generated file rename after I made a copy of existing h file.
So my DOGlobal.h was including DOHelpers.generated.h instead of including correct generated header. Do my DOHelper.generated.h was literally included twice, but for the different reason than stated in the error message. I just literally included it twice…

It was compiling alright for a while, likely because of the unity build, that’s I didn’t notice it right away.

In my case I was including → include “Interactable.generated.h”
In Interactable.h but also in Interactable.cpp
I had to remove it from Interactable.cpp

No need to rename or move folders, in my case

The “ShooterCharacter.generated.h” file belonging to my ShooterCharacter.h file was accidentally included in the .cpp file of another class (“BaseItem.cpp”). Because of this, I was getting an error due to reinclusion. I went and deleted the include from that file and the error was fixed. If this is the cause of your error, you don’t have to change the file name.

1 Like