Download

How do I compile an individual c++ file in Visual Studio 2013? (Ctrl-F7 Grayed out)

I’ve already asked this in the answer hub, but it’s driving me crazy and I don’t know how many people look at both places, so I’m asking it here too.

I have no problems building and running the Unreal Editor from Visual Studio 2013. However, when I make a change to a single file, and want to compile a single file (to ensure that it will compile before doing an entire build), the Compile option is grayed out in the Build menu (Also, CTRL-F7 does not work). Did I miss a setting or something?

https://answers.unrealengine.com/questions/15352/how-do-i-compile-an-individual-c-file-in-visual-st.html

To my knowledge you can’t because the projects are makefiles.

No, you don’t do that because even though you changed one file it may have other ramifications. Unreal Built Tool (UBT) exists to ensure that everything is compiled.

Compilling

Have you try’d this One last thing. You’ll want to setup your Windows shell so that you can interact with .uproject files. Find the file named RegisterShellCommands.bat in the UnrealEngine/Engine/Build/BatchFiles/ folder. Right click on the file and select run as Administrator. Now, you’ll be able to double-click .uproject files to load the project, or right click on .uprojects to quickly update Visual Studio files.

THis is for Source Builds

In your compiled Unreal Editor go to Compile -> Recompile Game Code or press Ctrl+Alt+Shift+P. It will only recompile changes not the whole source.

Do you know if you can do the same thing via cmd, batch or something?

That doesn’t quite get me the workflow that I want, as it will recompile all files that are affected by my changes.

What I really want to do is do a compile of a single h and cpp that I’m working on to ensure that there are no local compile errors before I build any dependencies. This way, I can quickly iterate on a single file, when it compiles and I’m satisfied that it will work correctly, I can then do my build and push the changes to the editor.

The only way you may be able to do this is by modding the way the Unreal Build Tool (UBT) works.

UBT generally wants to compile everything in that module and therefore not separate cpp files.

I am sorry but i don’t get where your problem is. Your dependencies will only compile if you changed them. If the dependencies need to be recompiled any ways then why not do it once and be done with it. Then you can work on that single file and only recompile that.

It’s extremely fast any ways, at least for me it takes a few seconds if i changed just one class.

I DO get where the problem is and I also would like to see a solution for it. Consider the following scenario: I am working on a specific feature which is contained in a single C++ file, but unfortunately it requires a change to some global header file that is used all over the place. I understand that I will need (and want) to re-compile all dependencies eventually, when the feature is ready to be integrated. However, while I am still working on the code, I’d like to compile that single C++ file to check the syntax and the names spelling are correct (the Visual Studio static syntax check sucks, only the compiler does it right). Having to re-build everything only to find that you need a minor tweak in that header file, which would triggers another total rebuild, is a huge waste of time.

UnrealBuildTool

+1 I also see this as a serious workflow problem.

The need to compile a single CPP file fast is really common, especially when it’s incredibly slow for Unreal to compile the project.

Really hope that Unreal could allow this in the near future.

The build system glues your files together to get around the difficulties Windows has to start new processes and to read files (itf so fr*cking slow…).

Disable Unity, enable FastIteration. I think there were changes more or less recently, so search around if it is so.

That might help you after the first complete build (that one, see above, will be slow). But when you change headers included all around the tree, it will take longer to build than it was with unity on.