Failed to add class, name already used

I am getting this error message when trying to add new classes (even with random profane names) to shootergame project. My first error message comes up as “Failed to add class [classname]. Failed to automatically hot reload the ‘ShooterGame’ module”. Then this error message comes up (name already used by another class, though it clearly isn’t) Imgur: The magic of the Internet

The editor log output shows the following:

Info Parsing headers for ShooterGameEditor  
Info Reflection code generated for ShooterGameEditor  
Info Performing 4 actions (4 in parallel)  
Info PCH.ShooterGame.ShooterGame.h.cpp  
Info Module.ShooterGame.cpp  
Info ShooterGame.generated.cpp  
Error C:\blah\ShooterGame\Source\ShooterGame\Private\Weapons\ShooterWeapon_Instant_FU.cpp(4)  : fatal error C1083: Cannot open include file: 'ShooterWeapon_Instant_FU.h': No such file or directory  
Info -------- End Detailed Actions Stats -----------------------------------------------------------  
Info ERROR: UBT ERROR: Failed to produce item: C:\blah\ShooterGame\Binaries\Win64\UE4Editor-ShooterGame-5669.dll  
Info Cumulative action seconds (4 processors): 0.00 building projects, 38.42 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.00 linking, 0.00 other  
Info UBT execution time: 47.69 seconds  

Afterwards, the class itself is created and present in the VS project, but not in the UE4 editor. If i try to build in VS, it fails complaining that the new .cpp file cant find the .h file which is clearly there. Restarting editor doesnt work. Clearing all local generated files (intermediate, build, VS project files etc) doesnt work.

To get VS building, I found that removing the #include “Classname.h” from the generated Classname.cpp actually let it build. But this new class doesnt show up in the UE editor…

Using the prebuilt binary 4.7.3 engine.
VS2013 Ultimate

This is really frustrating me, as all I want to do is to be able to add new classes without wasting my nights trying to figure out this stuff that should just work.

What is alsoconfusing is that I have been able to add classes in the past. And sometimes when I try adding a class, it seems to work… but then trying to add another class in the same spot just fails.

The error happens because we scan for filenames as well as UClasses, so if the add fails because the source files were added but then later failed to build, we’ll still pick up that there’s a file with that name and prevent you creating another class with that name.

It shouldn’t be failing to find that header though… I can see that the .cpp file was in “Source\ShooterGame\Private\Weapons\ShooterWeapon_Instant_FU.cpp”, but where was the corresponding .h file?

The header lives in “\Source\ShooterGame\Classes\Weapons\ShooterWeapon_Instant_FU.h”.
The files are added directly through the editor, and they seem to fail to build the instant they are added (during the auto compile that the editor performs on adding a class).

I’ve the same problem , with the same version build

anyway to fix it please?!

those two are suffering from the same thing, however , one of the staff confirmed it will be solved in version 4.8

I’m not sure, but this really cannot allow me to add any child classes to parent class

I looked into this some more, and it seems to be an issue due to ShooterGame so heavily relying on the semi-legacy Classes folder to the point that it didn’t even have header guards or properly set-up include paths. This essentially made it incompatible out-of-the–box with the in-editor class wizard.

We’ve updated this sample (as well as some of our others that were also set-up in this way) for 4.8 to reflect current practices in header layout, and this should address the issues with the in-editor class wizard.

Thanks for taking the time to investigate and reply Jamie. Figured it must have been something in shootergame adhering to legacy rules. Cheers.

I found a possible solution for this issue, I used
“const class FPostConstructInitializeProperties& PCIP” instead of “FObjectInitializer& PCIP”

this fixed the issue both for compiling and the name already exist issue