From 0ea555a98f5b9bcc0fb0d872e9edff8c8af3e7ee Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Fri, 31 May 2024 17:55:40 +0200 Subject: [PATCH] Windows Fix --- include/utils/global_defines.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/utils/global_defines.h b/include/utils/global_defines.h index 08c4a79a5..a79e7ea05 100644 --- a/include/utils/global_defines.h +++ b/include/utils/global_defines.h @@ -1,8 +1,31 @@ #pragma once +#include +#include + +#include + #define QSTRING_CSTR(str) str.toUtf8().constData() typedef QList< int > QIntList; +// Undefine the max macro if it's defined (Windows-specific) +#ifdef max +#undef max +#endif + +// Define your constexpr variable constexpr uint32_t UINT8_MAX_SQUARED = static_cast(std::numeric_limits::max()) * static_cast(std::numeric_limits::max()); +// Restore the max macro only if it was previously defined (Windows-specific) +#ifdef _MSC_VER +#define NOMINMAX // Prevent Windows.h from defining min and max macros +#endif + +// Restore the max macro if needed (Windows-specific) +#ifdef _MSC_VER +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#endif +