C++ Class Wizard kills project

Add a C++ Class via the Wizard (something from Show All Classes) to a code or BP project. If you are unlucky enough to select a class (AnimGraphNode or children, for example) that will fail to compile correctly - you’ll see a dialog indicating the failure. As installed, the new class won’t build successfully from VS either.

The problem really shows up later, after terminating the UE4 session. Attempt to open the project again and be told that a project DLL is missing or old. At this point the user has an option to Build or not. The build will fail and the project can’t be opened in Unreal. If the user tries to skip the build the project will still not open in UE4.

To recover an existing BP project so that it can be opened again in Unreal, I did the following: Delete the project Binaries, Build, and Intermediate folders. Removed the new class files. Finally, restore the .uproject file from backup.

When the project is damaged by a Wizard installed C++ Class - it will not open from the launcher or the editor.

It does not kill it, obviously is compilation error and the rest is consequence of failed compilation (if you rebuild, it deletes your module and you won’t have it until you compile it again). You need exact compilation error, thats why you have 0 idea whats happening… and other too because “failed compilation” means nothing. Open output tab in VS after compilation and you should find error there and search it near the names of source files that it outputted.

But i have suspicion whats going on based on class you mentioned, i think you missing module decency in build script, if you use class or function from specific module you need to add it to build script. Wizard only create source files but does not modify build script at all, you need to do that yourself. Not doing that results in linker error, not able to link to function you calling in other module,

So go to build script (C# file, *.Build.cs), there you will find “PublicDependencyModuleName” and add “AnimGraph” in to that list and it should work

In case if this happens again with different class or function call, check it in API refrence, you should have info from which module it’s coming for:

If you still having error regardless of doing what i mention above, search for exact error, because again, no body will able to help you… most importenly, helping yourself too

The goal of this bug report is not to fix a specific compiler error.

Start with a BP project and add a C++ Actor or Pawn or other class from the default Class Wizard screen. The class will compile and you will be left with a project that can be opened at a later time.

Instead, add something like AnimGraphNode. This results in this

. The warning doesn’t mention that the project can no longer be opened in the Editor.

A Wizard shouldn’t be leaving the project in a damaged state. Of course it would be great if the Wizard worked well with all the C++ Classes but it is probably more important for the Editor to load projects that might have unfinished / missing Classes.

And for the record, the missing module dependencies for AnimGraphNode is BlueprintGraph & AnimGraph.

Well people tend to post there problems on “Bug Report” because they think they not responsible for problems they getting, so sorry about that. I don’t think it’s project killing, C++ project starts exactly with that state and if dll is missing and say that compilation fails, it means you need to go to VS and solve problem and it something that candidate for C++ coder need to know. You could as well use some function from other module, click rebuild and have strange linker error that newbie won’t have idea about and you have exact same state.

I like idea of automatic module dependence adding in wizard, but not sure if it would be 100% bullet proof.

Imagine someone spending weeks / months on a BP-only project. Use the Wizard to add a C++ class to that project. Now the project will no longer open. Panic!

The Wizard feature implies that some automation is available that will help get a C++ class started. The side effect is pretty harsh.

Even if I’m returning to my desk to resume work in VS - the UE4 editor is the hub. I’ll load the project and launch VS from the menu there or by clicking on a class. So it is pretty strange to not be able to immediately resume work on the project by launching the UE4 editor.

If the user is just starting to explore C++ Classes - they know UE4 via the editor. The UE4 IDE can’t be used to fix the problem (delete the C++ class, perhaps) and it can’t be used launch the project into the needed tool.

Well VS has supervision here as it compiles module needed for your game to work, hot reload is not perfect and sometimes you will need to restart UE4 either way.

I think it’s better here if instead of rebuilding, make it build so old module stays.

But i’m not fan of treating people like clueless babies, specially once that want to code. When AI classes was moved to AIModule, people been reporting linker errors and they been helped here, now i don’t see people reporting this anymore because they probably finding solution themselves.

Hello ,

The C++ Class Wizard is there to set up boilerplate code for the most basic and commonly used C++ classes in UE4. In cases such as this, as pointed out, this is a compilation error based off your new class that you added. Most likely, the reason this happened is because either the class that you’re attempting to inherit from with this new class is not extendable or it’s not including the correct files to be able to extend that class. Another possible issue would be that you don’t have the correct modules included in your project (Such as needing UMG included for certain classes).

While the C++ Class Wizard is there for basic usage, it isn’t meant to be used with all classes unfortunately.

When this does happen however, if you have issues getting the class to compile correctly and wish to just return to how your project was previously, you can follow a few steps to do so. First, navigate to your project’s folder in the explorer and find the Source folder. Inside there, the .h and .cpp files should be present for the new class. Delete those particular files and then return to the root of your project folder. Right-click the .uproject file and Generate Visual Studio Project files. This will regenerate the .sln file to not include that class. At this point, your project should be restored to the previous settings.

Hope this helps!

Hi . I’m voting this answer up since the technique you mention might help others that run into this problem.

I submitted this report in an effort to improve UE4. I still maintain that a Wizard should do no harm to a functional BP project. Alternatively the user could be notified when a C++ class is selected that isn’t supported by the Wizard.

Many thanks for you time and effort on this!