Warning as Errors from Engine source

Hello!!

I am part of a team developing a plugin for the UE supporting 4.25 - 4.27. Currently, we are having a compilation problem on the UE side, where the VS2019 compiler complains about these:

 C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Core\Public\Math/Vector.h(1706): error C4062: enumerator 'EAxis::None' in switch of enum 'EAxis::Type' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Core\Public\Math/Axis.h(10): note: see declaration of 'EAxis::Type'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Core\Public\Math/Rotator.h(721): error C4062: enumerator 'EAxis::None' in switch of enum 'EAxis::Type' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Core\Public\Math/Axis.h(10): note: see declaration of 'EAxis::Type'

And, if we update the engine source, during the “linking” stage, it complain with the following files:

C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\PhysicsCore\Public\CollisionShape.h(130): error C4062: enumerator 'ECollisionShape::Line' in switch of enum 'ECollisionShape::Type' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\PhysicsCore\Public\CollisionShape.h(10): note: see declaration of 'ECollisionShape::Type'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\PhysicsCore\Public\CollisionShape.h(153): error C4062: enumerator 'ECollisionShape::Line' in switch of enum 'ECollisionShape::Type' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\PhysicsCore\Public\CollisionShape.h(10): note: see declaration of 'ECollisionShape::Type'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(149): error C4062: enumerator 'FInputActionUnifiedDelegate::EBoundDelegate::Unbound' in switch of enum 'FInputActionUnifiedDelegate::EBoundDelegate' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(315): note: see declaration of 'FInputActionUnifiedDelegate::EBoundDelegate'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(167): error C4062: enumerator 'FInputActionUnifiedDelegate::EBoundDelegate::Unbound' in switch of enum 'FInputActionUnifiedDelegate::EBoundDelegate' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(315): note: see declaration of 'FInputActionUnifiedDelegate::EBoundDelegate'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(185): error C4062: enumerator 'FInputActionUnifiedDelegate::EBoundDelegate::Unbound' in switch of enum 'FInputActionUnifiedDelegate::EBoundDelegate' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(315): note: see declaration of 'FInputActionUnifiedDelegate::EBoundDelegate'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(203): error C4062: enumerator 'FInputActionUnifiedDelegate::EBoundDelegate::Unbound' in switch of enum 'FInputActionUnifiedDelegate::EBoundDelegate' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(315): note: see declaration of 'FInputActionUnifiedDelegate::EBoundDelegate'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(276): error C4062: enumerator 'FInputActionUnifiedDelegate::EBoundDelegate::Unbound' in switch of enum 'FInputActionUnifiedDelegate::EBoundDelegate' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(315): note: see declaration of 'FInputActionUnifiedDelegate::EBoundDelegate'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(305): error C4062: enumerator 'FInputActionUnifiedDelegate::EBoundDelegate::Unbound' in switch of enum 'FInputActionUnifiedDelegate::EBoundDelegate' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Components/InputComponent.h(315): note: see declaration of 'FInputActionUnifiedDelegate::EBoundDelegate'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_Translucent' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_Stain' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_Normal' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_Emissive' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_Volumetric_DistanceFunction' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_AlphaComposite' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_AmbientOcclusion' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(123): error C4062: enumerator 'DBM_MAX' in switch of enum 'EDecalBlendMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\Materials/Material.h(66): note: see declaration of 'EDecalBlendMode'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Json\Public\Serialization/JsonSerializerMacros.h(1052): error C4062: enumerator 'EJson::None' in switch of enum 'EJson' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Json\Public\Serialization/JsonTypes.h(21): note: see declaration of 'EJson'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Json\Public\Serialization/JsonSerializerMacros.h(1052): error C4062: enumerator 'EJson::Null' in switch of enum 'EJson' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Json\Public\Serialization/JsonTypes.h(21): note: see declaration of 'EJson'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Slate\Public\Framework/MultiBox/MultiBoxDefs.h(132): error C4062: enumerator 'EMultiBlockLocation::None' in switch of enum 'EMultiBlockLocation::Type' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Slate\Public\Framework/MultiBox/MultiBoxDefs.h(106): note: see declaration of 'EMultiBlockLocation::Type'
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\MovieScene\Public\Evaluation/MovieScenePreAnimatedState.h(303): error C4062: enumerator 'EMovieSceneCompletionMode::ProjectDefault' in switch of enum 'EMovieSceneCompletionMode' is not handled
      C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\MovieScene\Public\MovieSceneSection.h(28): note: see declaration of 'EMovieSceneCompletionMode'

As a disclaimer, because we are a plugin dev, we would not be able to modify the code in our client’s engine. There was a post about modifying the Unreal VSToolChain, which is something we would not be able to do.

I tried using “pragmas” to disable the 4062 warning, or even set “warning(push 0)” to disable all warnings, but still they happen on the Engine part.

Is there any way to disable the “-WarningsAsErrors” or solve those errors presented by the engine??

Configuration:
Windows 10 Pro v19042
UE 4.25.4 (installed from Epic Launcher)
VS 2019 16.11.6
Compile project using RunUAT.bat

Thanks in advance,

If for some reason someone has this error, make sure that:

__pragma(warning(error : 4062))

is replaced by:

__pragma(warning(disable : 4062))

And that pragma does not spill over the UE code.