UniversalCRT include/library directories missing on project settings

So opening the project in Visual Studio 2015 constantly gives an error that the project was not able to compile due to corecrt.h file not being found. This also happens when I try to compile UE4 project.

After some research, I found a way to fix the issue. I have to select the project in the Solution Explorer, then go to Project > Properties > VC++ Directories and add the following paths to Include Directories and Library Directories respectively:

$(UniversalCRT_IncludePath);
$(UniversalCRT_LibraryPath_x64);

After doing this, right-click the project and select “Clean” and then “Build”.

After doing the steps above, everything builds and runs perfectly.

Here’s the Microsoft announcement about these changes:

My questions is if I’m missing some package when I installed Visual Studio 2015 or is UnrealEngine missing these include/library paths once it’s created?

Important note: I’m using Windows 10 and I don’t have any previous version of Visual Studio on my system.

This also affects Hot Reloading, which gives the same compiler error but I was unable to figure out how to get the include and lib path into the Unreal Build Tool,

Hi quinx,

The include paths that you are referring to should be inherited by the project in Visual Studio. If you select either the Include or Library fields and click the drop-down arrow and select Edit, the window that appears should have a checkbox labeled “Inherit from parent or project defaults”. Is that checked? If so, the Inherited Values section should include one or more macros. If you click the “Macros> >” button, it will show you a list of all of the available macros, and the paths that they contain. Check to make sure the macros that are shown in the Inherited Values section contain the path in the macros you listed above. In my case, the $(VC_IncludePath) macro contained the $(UniversalCRT_IncludePath) path, and $(VC_LibraryPath_x64) macro contained the $(UniversalCRT_LibraryPath_x64) path.

Hi , thanks for the answer.

If I check that option it works (but not hot reloads). Shouldn’t that be included by default? Why was it empty when I opened (and thus giving the compiler error)? Also, even if it compiles correctly, the UBT will still give me the same error on Hot Reloads, basically, whatever I changed in my include paths and lib paths are not being picked up by UBT. I believe UBT gets that from env variables?

I do see that UBT actually tries to find the CRT dir for VS2015:
https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Programs/UnrealBuildTool/Windows/VCEnvironment.cs#L541

Not sure if it matters but I noticed that my Universal CRT files were not installed where UBT is expecting them to be:

Mine is here:

Include: C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt

Lib: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10150.0\ucrt\x64

In UBT it seems it is:

https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Programs/UnrealBuildTool/Windows/VCEnvironment.cs#L565

C:\Program Files (x86)\Windows Kits\10\include

Not sure if auto searches subdirectories.

Actually, never mind, UBT is actually just getting the version there. I’m still concerned though why UBT is not picking up the includes and lib when I compile the game from the editor.

After a long time trying to figure this out I found that the main reason of this bug. It is because I had Windows Driver Kit installed.

It is/was a known bug in vcvarsqueryregistry.bat and apparently Unreal Build Tool is using the same logic.

With Windows Driver Kit installed, the include and lib directories of Windows Kits had more than one directory inside (wdf + a bunch of others) in C:\Program Files (x86)\Windows Kits\10\include AND C:\Program Files (x86)\Windows Kits\10\Lib and Unreal Build Tool was using the wrong directory.

To solve this issue, I just uninstalled Windows Driver Kit and now everything works. I suggest, though, a fix in the logic of Unreal Build Tool in case someone has the same problem I had and cannot uninstall Windows Driver Kit.

Hi quinx,

Thank you for the additional investigation that you performed for this issue. I am not sure I would have made the connection with Windows Driver Kit since I don’t have that installed. I have entered a ticket to have this situation investigated further (UE-22632).

Hi quinx,

I am looking at this issue and you have provided references to code in our Main branch which is not part of the 4.10 branch and the preview. Are you pulling Master directly? Or did this happen from 4.10 pull?

-Pete

Hi,

This was from Master directly. But I believe that I saw the same problem happening on 4.10 preview 2, but can’t confirm right now.

After installing WDK, I am also seeing issues when trying to build. I’ll see if I can figure out where it is coming from and get a fix for 4.10.

-Pete

Ok, so unfortunately, we won’t be able to get a fix for 4.10 because we are still calling the vcvars.bat to generate the environment variables and trying to change that at this late of a date is just not feasible. I am working on a fix for master and 4.11 where we are trying to remove the need for that in the first place.

-Pete

Have you been able to fix this for 4.11?

Hi ,

I took a look at this issue again, and we believe we have this corrected internally. The correction should have made it into 4.11.

I still have this issue (promoted branch)

please somebody help me …!!! https://answers.unrealengine.com/questions/411139/when-compiling-ue411-generateprojectfiles-error-we.html

Just integrated 4.11.2 and hit this issue. I’ve had a combination of WDK and SDK versions installed, after removing the WDK it still cannot find corecrt.h

Update:
So I’ve had to explicitly do a rebuild on the project for this to work, despite not having built the code before. A clean then build on the project does not have the same effect as a rebuild :frowning:

Cheers, Stace

Has anyone found a solution that also fixes the Hot Reloads issue?

Im using UnrealEngine 4.12.5 and i have this issue, i removed WDK but still get the error (even after rebuild in VS), but i notice i had 3 version of SDK: 10.0.10586.212, 10.0.14393.33, 10.0.26624. Should i remove the older version? (Im on Windows 10, version 1607, and i have same error as quinx).

Hi Saphirant,

There should be no problem with removing the older versions of the SDK, but there should also be no problem with leaving them there. Could you please try deleting the Intermediate folder in your Engine source code, then run GenerateProjectFiles.bat and build the Engine again?

Hello,

I can’t find where is GenerateProjectFiles.bat. Maybe its because i have the launcher installation. What should i do?