← Back to team overview

kicad-developers team mailing list archive

[PATCH v2 5/8] Work around missing min/max in Windows headers

 

Windows headers assume min/max to be macros, but we set NOMINMAX to hide
the macro definitions. This pulls in an alternative implementation.
---
 common/gal/cairo/cairo_print.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/gal/cairo/cairo_print.cpp b/common/gal/cairo/cairo_print.cpp
index 0204c69701..6cef33e9bd 100644
--- a/common/gal/cairo/cairo_print.cpp
+++ b/common/gal/cairo/cairo_print.cpp
@@ -25,6 +25,12 @@
 #include <wx/dcmemory.h>
 #include <wx/dcprint.h>
 
+#ifdef NOMINMAX         /* workaround for gdiplus.h */
+#include <algorithm>
+using std::min;
+using std::max;
+#endif
+
 #ifdef __WXMSW__
 #include <windows.h>
 #include <gdiplus.h>

References