Download

.Generated.h file not being "Created" for my C++ Classes?

Hey Guys,

Ok, I have these 2 custom C++ classes that I have ceated within the editor and did get created in Visual Studio, both header and .ccp file.

However, when it comes time to compile them, there is no .generated.h file that has been created for them, so it gives me errors.

How can I get past this?

Can I make them myself?

Does anyone know why this is happening?

Thanks,
Isabella.

Try writing



GENERATED_UCLASS_BODY()


in the header file class declaration!

Thank you The-Cowboy! Let me try that.

Thanks,
Isabella.

Amazingly enough, I am now facing the same error and GENERATED_UCLASS_BODY() is not helping.

Right click uproject file and generate the files from there, on windows explorer. If that doesn’t work then could be there something corrupted in project or engine installation or error on VisualStudio.
Also make sure your main header include the class you created.

Those “Intermediate” folders are the biggest annoyance of this engine ^^

UHT generates them at compile time, they don’t sit there all the time.

It will only generate it you have a reflected type in the header file, e.g. a UCLASS, USTRUCT etc.

So I am still getting the file not found error



Performing 4 actions (4 in parallel)

@progress 'Compiling C++ source code...' 0%

[1/4] Compile UTResetPostProcessVolumesCommandlet.cpp

[2/4] Compile UTResetLineUpDefaultsCommandlet.cpp

In file included from /home/the_cowboy/unrealworks/UnrealProjects/UnrealTournament/Source/UnrealTournament/Private/UTResetPostProcessVolumesCommandlet.cpp:4:

/home/the_cowboy/unrealworks/UnrealEngine/Engine/Source/Developer/SourceControl/Public/SourceControlHelpers.h:10:10: fatal error: 'SourceControlHelpers.generated.h' file not found

#include "SourceControlHelpers.generated.h"

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /home/the_cowboy/unrealworks/UnrealProjects/UnrealTournament/Source/UnrealTournament/Private/UTResetLineUpDefaultsCommandlet.cpp:4:

/home/the_cowboy/unrealworks/UnrealEngine/Engine/Source/Developer/SourceControl/Public/SourceControlHelpers.h:10:10: fatal error: 'SourceControlHelpers.generated.h' file not found

#include "SourceControlHelpers.generated.h"

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.

1 error generated.



despite the fact the file is there in [FONT=comic sans ms]Intermediate/Build/Linux/B4D820EA/UE4Editor/Inc/SourceControl directory. I believe somehow the code is not finding it there. So my question which component of Engine is responsible for searching the .generated.h files. I tried searching “In file included from” string but got no results.

P.S. Qt Creator does recognize the relevant .generated.h file.

The solution is simple. I followed Compiler Can Not Find DestructibleComponent.generated.h - UE4 AnswerHub and added the following code



PublicDependencyModuleNames.AddRange(new string] {
         "SomeRequiredUTModules",
        "SourceControl"    
        });


and now it recognizes the .generated.h files.

If I can get to know what code lines in UBT or UHT are associated with this process, I can write a logic to report appropriate error which for this case is not “file not found” but “module not found”.