From 34b3f7b7aa5570cd40a91d96e2203c8b13a3b7cb Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 6 Apr 2020 10:38:07 -0600 Subject: [PATCH] Avoid windows issue with min() max() macros Including the ``windows.h`` file without defining ``NOMINMAX`` will define the `min()` and `max()` macros which will result in issues compiling any C++ code that uses any variant of `max`, for example `std::numeric_limits::max()` and many others. Although max() isn't used in Fmt anywhere, it is often used in codes that include a format include file so simply upgrading to the current version of lib::fmt will break the windows build which worked prior to the update... --- include/fmt/format-inl.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index f632714d..788eb8da 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -22,8 +22,14 @@ #endif #ifdef _WIN32 +# if defined(NOMINMAX) +# include +# else +# define NOMINMAX +# include +# undef NOMINMAX +# endif # include -# include #endif #ifdef _MSC_VER