In-Editor Compile Button Fails for VS 2015

It will only work if you have VS 2013 also installed as well as VS 2015.

— Log Output —

[2015.10.17-11.37.52:888][237]Recompiling MyProject...
[2015.10.17-11.37.52:888][237]Building UnrealBuildTool...
[2015.10.17-11.37.52:889][237]Building UnrealBuildTool in C:/Users/itchr/Desktop/UnrealEngine/...
[2015.10.17-11.37.52:889][237]Couldn't find ../../VC/bin/x86_amd64/vcvarsx86_amd64.bat; skipping.
[2015.10.17-11.37.52:889][237]Failed to build UnrealBuildTool.
[2015.10.17-11.37.52:889][237]CompilerResultsLog: New page: Compilation - Oct 17, 2015, 1:37:52 AM
[2015.10.17-11.37.52:889][237]LogMainFrame: MainFrame: Module compiling took 0.003 seconds
[2015.10.17-11.37.52:889][237]Warning: RebindPackages failed because the compiler could not be started.

— Reproduction —

  1. Only have VS 2015 installed
  2. Start the Unreal Editor version 4.10 Preview
  3. Create a new C++ project
  4. Press the ‘Compile’ button in the editor

Hey Pumpy Bird-

Are you using the preview from the Launcher or from GitHub? After removing VS2013 from my machines I opened the 4.10 Preview from the Launcher and created a blank C++ project which compiled successfully using the In-Editor button. I also tested adding a new class to the project and editing it to force a hot reload and used the In-Editor compile again. This was tested using Windows 7. Let me know if there is anything I’ve missed along with the OS version you’re using.

Cheers

Here is some more information:

  1. I’m building UE4 4.10 from GitHub source with no modifications.
  2. Windows 10
  3. Intel i5 Processor
  4. GTX 780 Graphics
  5. Fancy Mouse (J/K)

Here is the issue I found in the code base.

In

bool FDesktopPlatformBase::BuildUnrealBuildTool(const FString& RootDir, FOutputDevice& Ar)

the code

#if PLATFORM_WINDOWS
	#if _MSC_VER >= 1800
		FPlatformMisc::GetVSComnTools(12, VCVarsBat);
	#else`enter code here`
		FPlatformMisc::GetVSComnTools(11, VCVarsBat);
	#endif
#endif // PLATFORM_WINDOWS

is calling

bool FWindowsPlatformMisc::GetVSComnTools(int32 Version, FString& OutData)

with “Version” equal to 12 when it should be 14 for VS 2015. So it’s searching for the wrong key in the registry. So it can’t find the path to the Visual Studio 2015 directory.

Presumably the reason it still works on your machine is that Visual Studio 2013 did not fully uninstall itself, and left some registry keys, and possibly some files behind in the old directory. Perhaps this is why the bug has gone uncaught.

You should be able to repro the bug consistently on a fresh install of Windows, but that is allot of trouble I realize. But you can see for yourself in the code where the issue is. It will never find the VS 2015 install directory as it is using the wrong key.

I have submitted a pull request with a fix for the bug to the Master branch (all versions of the engine share the same bug).

https://github.com/EpicGames/UnrealEngine/pull/1686

I have tested this simple fix throughly on my computer and it works with no side effects.

I can consistently reproduce this bug with a fresh install of Windows 10, Visual Studio 2015 Enterprise, and building (any version of) Unreal Engine from source.

As an alternative to a fresh install of windows, you could almost surely repro it if you make sure to remove all Visual Studio 2013 registry keys manually after uninstalling it.