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

When Windows SDK 10.0.18362.0 is installed, the build tools for Unreal Engine 4 automatically pick it, even though the actual code does not seem to be fully compatible with the SDK version. Even if other Windows SDKs are installed, the build tools will always pick the latest one instead of selecting the most compatible one.

Is there any way to actually fix this without just giving up and uninstalling the Windows SDK every time I want to work on Unreal Engine 4 code?

As seen on this help page, it seems that you can indeed overide the Windows SDK version at configure time. This takes a little bit of knowledge of the build system, but with the following xml file stored in “My Documents/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml” it correctly switched to 10.0.17134.0:

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
	<WindowsPlatform>
		<WindowsSdkVersion>10.0.17134.0</WindowsSdkVersion>
	</WindowsPlatform>
</Configuration>

This should probably help other people that also ran into this issue and had no luck with a Google search on how to fix it.

The default value for WindowsSdkVersion at the moment actually seems to be 10.0.16299.0, which should be automatically selected if installed.

Thanks its been a great help. I have added to the standard override to get Visual Studio 2019 as the default

VisualStudio2019

Hi, I’m a new user of UE and I want to compile UE4.21 from source (since I need to add a patch to the source code). Currently the latest version Visual Studio is VS2022 and I consistently get the same “NDIS_MINIPORT_MAJOR_VERSION” bug. I’m wondering whether downgrading my Visual Studio to 2019 and also downgrading the Windows SDK will solve this issue? Thanks a lot!

1 Like

Hi, i just want to say how i solved mine.
I just added these lines of code:

#ifndef __has_feature

#define __has_feature(x) 0

#endif

Into a general config file (i added to to the one unreal was pointing the error to) or you can even add it to the header file of the class you are trying to build and then it compiles with no problem.