Getting "error C4756: overflow in constant arithmetic" while building Unreal 5.4.2 from source code

This is valid when I package the engine source code, thank you very much!

Yes, I resolved the issue by compilling the project with the SDK version recommended in the ā€œUnreal Engine Release Notes.ā€

Bit of a necro but Iā€™d like to narrow down the fix to this problem.

I just successfully compiled a 5.4.4 engine version from source.

Fiddling with VS individual components from the visual studio install does not change which version of windows SDK is taken into account. You can uncheck the the latest version and check and older version and it doesnā€™t make a lick of difference.

Unrealā€™s build tool will automatically target the latest windows SDK and will cause the overflow error somewhere around the 4700 file compile mark.

To counteract this you need to manually edit the build configuration file at the path

Folder Where you have your unreal source\UnrealEngine\Engine\Saved\UnrealBuildTool\BuildConfiguration.xml

By default itā€™s pretty bare bones

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

You need to manually specify the SDK like this:

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

I went with Windows Sdk Version 10.0.22621.0

10.0.26100.0 (lastest at this time) would cause crashes.

Make sure that while compiling when unreal displays the MSVC version and Win SDK version in the output windows that the version number matches the overridden one in the xml file.

This can save around 40 min of compile time if you know ahead of time that there is a mismatch.