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

**URL:** <https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276>\
**Category:** Getting Started & Setup\
**Tags:** source-build, unreal-engine, Engine-Source-Code\
**Created:** [June 10, 2024, 8:08am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276 "2024-06-10T08:08:21Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![xuxiaoqi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xuxiaoqi](https://forums.unrealengine.com/u/xuxiaoqi)\
**Post date:** [October 23, 2024, 3:16am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/21 "2024-10-23T03:16:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![whikqp](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/whikqp/32/968156_2.png) [@whikqp](https://forums.unrealengine.com/u/whikqp)\
**Post date:** [January 7, 2025, 1:53am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/22 "2025-01-07T01:53:39Z")

</div>

Yes, I resolved the issue by compilling the project with the SDK version recommended in the “Unreal Engine Release Notes.”

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [February 9, 2025, 8:57pm UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/23 "2025-02-09T20:57:26Z")

</div>

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

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

```

By default it’s pretty bare bones

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

```

You need to manually specify the SDK like this:

```auto
<?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.

---

<div class="post-metadata">

**Author:** ![Online\_Learner\_wvGIt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Online\_Learner\_wvGIt](https://forums.unrealengine.com/u/Online_Learner_wvGIt)\
**Post date:** [May 12, 2025, 3:46am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/24 "2025-05-12T03:46:29Z")

</div>

It works,3q

---

<div class="post-metadata">

**Author:** ![klobodnf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@klobodnf](https://forums.unrealengine.com/u/klobodnf)\
**Post date:** [May 30, 2025, 8:06am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/25 "2025-05-30T08:06:18Z")

</div>

it’s work, clean project and recomplile agian, thanks!

---

<div class="post-metadata">

**Author:** ![amoyer\_avs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@amoyer\_avs](https://forums.unrealengine.com/u/amoyer_avs)\
**Post date:** [June 12, 2025, 1:19pm UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/26 "2025-06-12T13:19:21Z")

</div>

Hello,

The best option in my opinion is to use the preprocessor variable \_UCRT\_LEGACY\_INFINITY that has been added to the corecrt\_math.h header:

 ![Diff between 10.0.22621.0 and 10.0.26100.0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/3/6d30cc99b087d2fdee47f6fb949508d70b097957.jpeg)

That can be achieved by adding this line to the Build.cs file:

```auto
PublicDefinitions.Add("_UCRT_LEGACY_INFINITY");

```

---

<div class="post-metadata">

**Author:** ![TrueFranco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/truefranco/32/1095055_2.png) [@TrueFranco](https://forums.unrealengine.com/u/TrueFranco)\
**Post date:** [June 29, 2025, 8:18am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/27 "2025-06-29T08:18:07Z")

</div>

Thank you Sir.

---

<div class="post-metadata">

**Author:** ![MeloinUnreal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MeloinUnreal](https://forums.unrealengine.com/u/MeloinUnreal)\
**Post date:** [December 3, 2025, 9:33pm UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/28 "2025-12-03T21:33:03Z")

</div>

there is a commit which fix all issues for 4.27 with new win sdk  
[https://github.com/GapingPixel/UE5-PhysX-Vite/commit/37a8ebfb6cd50ba2533d0b36e0da1f4640268ec9](https://github.com/GapingPixel/UE5-PhysX-Vite/commit/37a8ebfb6cd50ba2533d0b36e0da1f4640268ec9)

---

<div class="post-metadata">

**Author:** ![johny5.coder](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@johny5.coder](https://forums.unrealengine.com/u/johny5.coder)\
**Post date:** [January 4, 2026, 5:58am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/29 "2026-01-04T05:58:31Z")

</div>

To resume, options:

1. Patching Unreal code as in [@MeloinUnreal](https://dev.epicgames.com/community/api/user_profiles/tab-redirect/about?discourse_username=MeloinUnreal) post. This is quite invasive fix though, but the right way to go. Should be accepted as a PR.

2. Modify your `C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\corecrt_math.h`

3. Patch your UnrealBuildTool, at `Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs` inside `CreateTargetRulesInstance` look for `Rules.GlobalDefinitions` setup and, for example, after:

---

<div class="post-metadata">

**Author:** ![WL142857](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WL142857](https://forums.unrealengine.com/u/WL142857)\
**Post date:** [July 1, 2026, 5:31am UTC](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276/30 "2026-07-01T05:31:16Z")

</div>

[Build Configuration for Unreal Engine | Unreal Engine 5.8 Documentation | Epic Developer Community](https://dev.epicgames.com/documentation/unreal-engine/build-configuration-for-unreal-engine) this is where the config file location

[Previous page](https://forums.unrealengine.com/t/getting-error-c4756-overflow-in-constant-arithmetic-while-building-unreal-5-4-2-from-source-code/1897276.md?page=1)
