From 4d96a82ed9935debad63826a465da79c7429dd3c Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 31 Jan 2023 22:28:06 +0100 Subject: [PATCH] Workaround unfortunate macro definition in `windows.h` --- conversion/stringconversion.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/conversion/stringconversion.cpp b/conversion/stringconversion.cpp index 3314b0d..18a7f01 100644 --- a/conversion/stringconversion.cpp +++ b/conversion/stringconversion.cpp @@ -20,6 +20,13 @@ #ifdef PLATFORM_WINDOWS #include +// note: The windows header seriously defines a macro called "max" breaking the (common) use +// of std::numeric_limits in the subsequent code. So we need to undefine this macro. Note that +// this is not the case using mingw-w64 but it is happening with windows.h from Windows Kits +// version 10.0.22000.0 via Visual Studio 2022. +#ifdef max +#undef max +#endif #endif using namespace std;