Are c++ files broken in your game? I found this weird way to maybe fix them when nothing else works

Already, another day and another weird problem I have encountered/fixed haha. So I was having trouble adding new c++ classes to my game, I tried everything I could and nothing was working. VS wasn’t a problem, Unreal Engine (in a way) wasn’t a problem, but somewhere along the journey of development something broken and I was unable to add new c++ files to my project. None of the other threads helped so I thought I would post my findings.

I tried to add a c++ of any type and I would get the following error


Successfully added class 'NewActorComponent123', however you must recompile the 'SemesterProject' module before it will appear in the Content Browser. Failed to automatically compile the 'SemesterProject' module.

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

It creates the cpp and the h files but they don’t show up in the editor and I can’t use them, even with the UCLASS(). This problem was happening with both 4.14.3 source from github and 4.14.3 from launcher, disabling plugins and trying every combo of things I could think of and the problem persisted.

In an attempt to eliminate possible causes I made a new project and it DID work as it should, both from source and launcher. I also made a copy of this new project and renamed it and c++ thinking maybe that broke it, nope still works. I added plugins to the new project, still worked… hmm. So I went back to my “real” project to test some stuff. I tried it on a different computer, doesn’t work. I tried deleting intermediate and saved folders and regenerating project files, didn’t work. I tried building the game source code from within VS and it didn’t work. I tried many other things with no luck.

Then I opened a blueprint pawn and added new c++ component, I get the same error, however this time the editor crashes completely. I go ahead and send the error report and restart. When the editor loads up again, I created a new c++ (by right clicking and adding c++ from the content menu) and after it finishes creating all of the prior c++ files pop up and EVERYTHING works all of my c++ files are now working and shown in the editor! One problem though, I can’t get rid of that very last c++ file even with the normal delete process, other files delete fine just not the newest one, small price to pay I guess. I then reproduced this to see if this “fix” is consistent and indeed it worked again. I have no idea why it works, but it does. Maybe this info will help someone else in the future :slight_smile: