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

(Please also read the 2nd message, most probably it is related to installing Windows SDK)
I was able to build Unreal engine from source code previously. After some time, I tried again with Unreal 5.4.2 version with VS 2022. It compiled almost all of the files, however I received several errors saying:
“error C4756: overflow in constant arithmetic”

[1/387] Compile [x64] Module.AudioSynesthesiaCore.cpp
PATH\Engine\Plugins\Runtime\AudioSynesthesia\Source\AudioSynesthesiaCore\Private\PeakPicker.cpp(17) : error C4756: overflow in constant arithmetic
   while compiling Audio::FPeakPicker::FPeakPicker
[2/387] Compile [x64] Module.RenderCore.2.cpp
PATH\Engine\Source\Runtime\RenderCore\Private\RenderGraphPrivate.cpp(196) : error C4756: overflow in constant arithmetic
   while compiling GetClobberValue
[3/387] Compile [x64] Module.LiveLink.cpp
PATH\Engine\Plugins\Animation\LiveLink\Source\LiveLink\Private\LiveLinkClient.cpp(1728) : error C4756: overflow in constant arithmetic
   while compiling FLiveLinkClient_Base_DEPRECATED::PushSubjectData
[4/387] Compile [x64] Module.PoseSearch.3.cpp
PATH\Engine\Plugins\Animation\PoseSearch\Source\Runtime\Private\PoseSearchLibrary.cpp(134) : error C4756: overflow in constant arithmetic
   while compiling FMotionMatchingState::Reset

When I check the source code, I see it is related to macro definition of INFINITY and storing that value within float typed variables.

Settings.MeanDelta = FMath::Clamp(Settings.MeanDelta, 1e-6f, INFINITY); (PieakPicker.cpp, line 17)

Here is how INFINITY is defined in corecrt_math.h

#ifndef _HUGE_ENUF
    #define _HUGE_ENUF  1e+300  // _HUGE_ENUF*_HUGE_ENUF must overflow

#define INFINITY   ((float)(_HUGE_ENUF * _HUGE_ENUF))

My build process is like that:

./GenerateProjectFiles.bat -2022

          ./Engine/Build/BatchFiles/RunUAT.bat BuildGraph     `
            -script="Engine/Build/InstalledEngineBuild.xml" `
            -target="Make Installed Build Win64"            `
            -set:HostPlatformOnly=true                        `
            -set:GameConfigurations=""                        `
            -set:WithFullDebugInfo=false                      `
            -set:WithDDC=false       			      `

I was able to compile like that some times ago, but unfortunately not this time.

I want to learn why I got these errors and what is the solution?


I have additional feedback. I have another build pipeline which was working fine but it also started giving errors…

Recently I installed Windows SDK - Windows app development | Microsoft Developer version 10.0.26100.1 because Unreal Build process was complaining about pdbcopy.exe being missing and it guided me to install Windows 10 SDK.

After installing Windows 10 SDK 10.0.26100.1 from the link above, my builds started giving error.

same issue here

Same stuff here as well. I would also like to know a solution to this.

As I mentioned in the first 2 messages, my problem was related to Windows SDK version because INFINITY is defined in the headers coming by SDK package. Either there is a problem with the newest SDK version or we installed an incorrect version of the SDK (like Windows 11 SDK to Windows 10 SDK, just speculating)

The solution for me is to Uninstall the most recent version (10.0.26100.1) and installing “Windows SDK for Windows 11 (10.0.22621.755)”

The SDK archive can be found in this page: Windows SDK and emulator archive | Microsoft Developer


Same here, 5.4.2 with latest vs2022 17.10.3. I’ve ticked both win 11 sdk 10.0.22621.0 and 10.0.26100.0 in the vs installer, hence lots of C4756.

Thanks to @balikamca Untick 10.0.26100.0 fixed the issue.

Before remove 26100(the win11 sdk for 24H2 later this year), I tried replace INFINITY macro with both std::numeric_limits::infinity() and it’s ultimate calling builtin function of __builtin_huge_valf(), they both worked.

1 Like

Thanks for the advice, it works for me by replacing for each error (4 or 5) INFINITY with std::numeric_limits<float>::infinity()

I’m still getting the error on my project, unfortunately.

Not only that, but I removed and reinstalled VS 2022 and my UE 5.2 github repository, then attempted to build and have the same error.

The error occurs building UE with VS and building my project with UGS.

ubt> [5/184] Compile [x64] Module.AudioSynesthesiaCore.cpp
ubt> D:\p4\lunacy\main\UnrealEngine\Engine\Plugins\Runtime\AudioSynesthesia\Source\AudioSynesthesiaCore\Private\PeakPicker.cpp(17) : error C4756: overflow in constant arithmetic
ubt> [6/184] Link [x64] UnrealEditor-AudioSynesthesiaCore.dll cancelled
ubt> [7/184] Compile [x64] Module.RenderCore.2_of_5.cpp
ubt> D:\p4\lunacy\main\UnrealEngine\Engine\Source\Runtime\RenderCore\Private\RenderGraphPrivate.cpp(193) : error C4756: overflow in constant arithmetic

I followed this as closely as possible, though I’m using the Windows 11 SDK our team uses and the UWP setup is different now.


My settings match those of our Engineer, which match those of the 5.2 setup article, except for that W11 sdk.