A compilation Error every time a class is just added by the class wizard

Hey, I added a class derived from AnimGraphNode_Base through the class wizard, and it shows me an error message.

This is the message quoted:

"Successfully added class ‘MyAnimGraphNode_Base’, however you must recompile the ‘July’ module before it will appear in the Content Browser. Failed to automatically hot reload the ‘July’ module.

Would you like to open the Output Log to see more details?"

Then the project fail to compile constantly.
I’ve tried this on versions 4.10, 4.14, and 4.16

Hot reload is spotty at best. Just re-compile from within Visual Studio and the error will go away.

2 Likes

Can you please write step-by-step, what i need to do?

I closed project, go to VS, click to re-compile, but has errors.

I hope you need not to rebuild the project ?

I’m not sure what u mean.

Typically if Unreal fails to build a new class it means Visual Studio will fail as well. But VS provides more info on the issue. Right click on your project in Visual Studio and hit build. After building fails paste the info from the VS output log.

1 Like

Did someone find a solution for this? I’m new to UE4 and AirSim, I tried to create a C++ class on my Blocks module and I got “Successfully added class ‘MyActor’, however you must recompile the ‘Blocks’ module before it will appear in the Content Browser. Failed to automatically compile the ‘Blocks’ module”.
The .h and .cpp are created in a Source folder within Bocks and AirSim, but nothing appears in the “Content” folder…

Can anyone help me?
TIA

There may be two paths to store C++ class files in your project, resulting in no header files found, such as some files outside Public and some inside public files.

Ok, but I still can’t open them in the UE4 editor. Plus, when I created this class, the build failed and I got these errors in the message log:

and

I think Unreal Header Tool is having a problem with the file/ class that I created, ‘My Actor’, but I don’t really know how to solve this issue…
If anyone can help :)… Here is my full post: https://forums.unrealengine.com/deve…c-class-on-ue4

Someone got the answer for this?

I have been having a lot of trouble with creating c++ classes as well. Whenever I create an actor class from the class wizard, I get the same hot reload error. I tried recompiling it again in VS but I still get errors in my VS error list. I do not know how to fix this issue and I have been frustrated with this issue for the past 3-4 days. I have attached photos of the errors I get from VS and output log and error message I get from unreal engine. Someone please help.

Disable automatic compiling and close the editor. Avoid trying to add/compile new classes with the editor open is the best bet.

I was able to recompile by closing the project and reopening it, there was a default checker that prompted to recompile when re-opened

I noticed in the generated CPP files the include headers were wrong.

Eg:

I created an Actor class called “MyTestActor” under the GameplayActors folder
It generated the “MyTestActor.h” and “MyTestActor.cpp” files as expected under the GameplayActors folder

When I open the cpp file, I notice that the for the include it was written :
#include “GameplayActors/MyTestActor.h”

Instead it should be :
#include “MyTestActor.h”

Did this change and built the project and it worked

5 Likes

I got the same error message from Unreal Engine editor when I try to create a class in a custom subfolder. Mainly, I saw neither my subfolder nor my created class in UE editor (But in VS solution viewer it was ok).

As Acnologia_Drag said, I checked in the .h and .cpp files the inclusion path of the header and I were able to corroborate that .cpp file includes wrong path (automatic class code generator added subfolder path and caused double folder path inclusion, for example real path was “src/custom/customclass.h” and path generated was “src/custom/customclass.h”). Just, I deleted that wrong file path from .cpp file, recompiled project from VS and Unreal Engine editor works fine (i could see right subfolder with class inside).

I post this if somebody else got the same message following the same steps and want to fix it.

I had a similar error. When adding a class through the editor, without specifying public-private, but not in the root directory, the build began to fall.
Code generation adds /folderName to ClassName.h in the include section of the .cpp file. After deleting /folderName, the project builds normally again.

This problem is very annoying and in fact the solution is always to close the Unreal Editor before compiling in Visual Studio that everything is solved. I’ll leave the documentation link below.

By default, a Hot Reload is initiated if you:

  • Compile from your IDE with your project/Unreal Editor open
  • Compile using the Compile button within Unreal Editor
  • Create new C++ classes inside Unreal Editor
    • You can stop this from occurring by disabling this setting in Editor Preferences: Automatically Compile Newly Added C++ Classes
1 Like

Thank you so much for putting this answer here. I’ve had days of scratching my head over this. I even did a completely clean install of VS and Unreal engines on a brand new SSD to avoid seeing this error the first time I wanted to add a custom C++ component, only to find it happening again. Why would Unreal even include an automatic compile for newly created C++ classes if it’s causing this kind of problems to the project? Coming from a different game engine where creating new classes inside the editor did not produce a single problem ever, I am still scratching my head why it’s even possible out of the box if it isn’t actually possible.

If I ever find out more, I’ll come back and post here. :slight_smile:

Look into if it is your uproject missing the module runtime pointing to your c++ build file n stuff

I closed the project, opened VS, built the project, and now Unreal can see the C++ files. Thank you.