[4.7.6] Error on adding code to project

Hi, I recently came back to UE4 and downloaded the latest stable version of the engine to start a project, but I’m receiving an error in any 4.7.6 project I make when trying to create a new C++ class:

“Error: failed to generate code for myprojectEditor - errorcode: FailedDueToHeaderChange (1)”
and “Compile failed due to header changes. Close the editor and recompile in IDE” box pops up in the bottom right of the editor.

I’ve tried clearing AppData/Local/Temp, starting a new project, compiling from visual studio (works), but whenever I try to add a new class I receive an error, and whenever I try to use the compile button in-editor it’s non-responsive.

The class that “fails to create” shows up in visual studio, but it isn’t automatically compiled and my visual studio solution isn’t automatically refreshed like it did with earlier versions of Unreal.

Hi ,

Can you give me precise steps of what you do to get this error from when you open the editor to when the error occurs? I’ve never seen this error message before and I can’t imagine what may be causing it. Also, are you using a version you downloaded through the launcher or a source code version of the engine?

I just tried starting a new project again and copy pasting the 1-2 classes I had written before I stopped because of the compile error. It seems as though it’s working now, but I can’t imagine what changed. I just recently came back after putting my computer to sleep, but I also put it to sleep in between bouts of trying to tackle the bug last night. I started a new project earlier which had the same error before. However, the project I started just now seems to work.

The only thing I can think of that may have made a difference was following the “Close the editor and recompile in IDE”. Doing so didn’t fix the project (it’s still broken), but since doing that it seems new projects are working.

Well that surely is odd. For the moment I’ll convert your comment into an answer and the issue as resolved. If this issue does rear it’s head again however, please feel free to comment so that the question will reopen.

For the project that is still broken however, try deleting the Binaries, Saved, Intermediate, and the .sln file. After this, right click the .uproject file and ‘Generate Visual Studio Project Files’. After that, open the new .sln and compile. Try using the project after that and see if the issue persists.

I think I figured out the bug. If I try creating a new C++ class with “none” (no inheritance) as the first C++ class of my project, it breaks compiling from the editor for the project from there on out (and the step of compiling new classes when they’re made).

Tested it twice for each case. Reproduction rate seems to be 100%.

As I said in my other comment, I figured out how to reproduce the bug. Let me know if the same method produces it for you.

Using your method, does it fail compiling when you go to add that first class that has no inheritance?