Error C4668: "__cplusplus" not defined

after updating UE to 4.21 and Visual Studio 2017 to 15.9.3 i got this error:
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt.h(212): error C4668: “__cplusplus” not defined…

anyone know how solve this?

Stumbled across this link. Are you building to Win-32 instead of Win-64?

I’m having same problem. And i’m building win64

Side note: I had switched to building another project for android, installing all tools nessessary. then came back to think project thats being built for PC. very weird that i can build a different project for android.

this error is due to plugins needing to be built on a fresh install from repo. So editor never has a chance to open.
[1/18] applink.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt.h(212): error C4668: ‘__cplusplus’ is not defined as a preprocessor macro, replacing with ‘0’ for ‘#if/#elif

I’m having the exact same problem trying to use miniz in my project.

Very interested in a solution.

I will update here if i find one.

For this specific error install an older version of Windows SDK 10. I installed Windows 10 SDK 10.0.16299.0.

Windows 10 SDK > 10.17134.0 introduced a bug.

Details here

Fixed in a future release here

already saw details, but you pointed me out to SDK 10. Thank you!

As noted above, Windows SDK 10.17134.0 has a bug.

I’ve added a hack fix into our VCToolChain to work around it for now by not erroring on C4668

Engine/Source/Programs/UnrealBuildTool/Platform/Windows/VCToolChain.cs:489

				if (CompileEnvironment.bUndefinedIdentifierWarningsAsErrors)
				{
					//BEGIN TBS - this currently chokes on the Windows 10 SDK shipping with VS 2019
					if(EnvVars.WindowsSdkVersion.ToString().Contains("17763.0"))
					{
						Arguments.Add("/w44668");
					}
					else
					{
						Arguments.Add("/we4668");
					}
					//END TBS
				}
				else
				{
					Arguments.Add("/w44668");
				}

add PublicDefinitions.Add("_CRT_HAS_CXX17=0") in build.cs will fix this

1 Like

It is worked, good!