"Adding code to project" never finishes; how do I fix this?

Every time I’ve tried to add C++ code to a project, when it gets to the progress bar saying “Adding code to project…” it’s always freezed part of the way through. Once I left it running for what had to be at least a half hour, and nothing changed. The only way to stop it is to close the Unreal editor from Task Manager.

Then, when I try to reload the project, it says the following:

The following modules are missing or built with a different engine version:


Would you like to rebuild them now?

[Yes] [No]
Choosing No simply quits. Choosing Yes opens a window that says “Starting build…” and has a Show Log button. This process never finishes either, and the log only gets this far:

Running C:/Program Files/Epic Games/4.7/Engine/Binaries/DotNET/UnrealBuildTool.exe [project name] Development Win64 -project="[path to .uproject file]" -rocket -editorrecompile -progress

Parsing headers for MyProject2Editor

Reflection code generated for MyProject2Editor

How do I fix this?

(Sorry about the oddly-formatted log text; for some reason I was having trouble getting the format to work.)

Adding a new class now tries to perform a build and hot-reload of your game module. It sounds like that is failing for some reason.

Are you able to build your game module normally via Visual Studio?

You could try disabling the automatic hot-reload when adding new classes, however please note that this will prevent them appearing in the Content Browser until you next rebuild your game module. See “Editor Settings” → “Miscellaneous” → “Hot Reload” → “Automatically Hot Reload New Classes”.

It will be generated alongside the .uproject file for your project. If they’re missing, you can right click on the .uproject file for your project and select “Generate Visual Studio project files” from the Explorer context menu.

This seems to be a similar error to this: Problem creating new project in 4.7.1 - Community & Industry Discussion - Epic Developer Community Forums

Could you try the solution in the first comment (about inheriting properties) and let me know if that works.

Can I also just check which version of Visual Studio you’re using (eg, VS2013 Pro, VS2013 Community, VS2013 Express for Windows Desktop, etc).

I don’t think disabling the hot-reload would help, considering I’d still need to build it eventually. I’ll try compiling it manually though; where’s the VS project file/makefile/whatever it uses?

Now I’m getting this: (right click and select “view image” if it’s too small)

Keep in mind that despite the “generic” look the errors have (can’t find windows.h stands out) I’ve been able to successfully compile other C++ code on this computer, just not for Unreal.

That works! Can you please post it as an answer so I can accept it?