Error C4668: 'WINAPI_PARTITION_GAMES' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

Build started…
1>------ Build started: Project: UE4, Configuration: Development_Editor x64 ------
1>Building UE4Editor and ShaderCompileWorker…
1>Using Visual Studio 2019 14.29.30133 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 5 actions with 36 processes…
1> [1/5] Module.ElectraPlayerRuntime.1_of_4.cpp
1>D:\EpicGames\UnrealEngine-4.27.0-release\Engine\Source\ThirdParty\Windows\DirectX\include\d3d12.h(427): error C4668: ‘WINAPI_PARTITION_GAMES’ is not defined as a preprocessor macro, replacing with ‘0’ for ‘#if/#elif
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command “…..\Build\BatchFiles\Build.bat -Target=“UE4Editor Win64 Development” -Target=“ShaderCompileWorker Win64 Development -Quiet” -WaitMutex -FromMsBuild” exited with code 6.
1>Done building project “UE4.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

2 Likes

got this error while compile the engine of UnrealEngine-4.27.0-release.zip

same issue…

Same here too…

Same here

In VS2019 I just selected all of the SDK Win 10 packages and installed them + the Nuget packs too and now it’s building without any errors.

I hope this will help others too!

2 Likes