summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-05-07 15:48:24 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-05-07 15:48:24 +0200
commit374232e2f483119ef73a59159c885b483cc9325a (patch)
treec4de4aa6ba85a816a46f075e289569e688f6996a /src
parent4190cd5426efb4f9c30109bd914a1de12ed241fb (diff)
Fix MSVC 2010 and older not finding round()
Actually we don't know about some newer MSVC versions, but current version MSVC 2019 works fine w/o defining round(). If other MSVC versions need this as well we can change the version test or add a compiler feature test to CMake (configure not required).
Diffstat (limited to 'src')
-rw-r--r--src/Fl_win32.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 1e5b73248..1ef76cb6c 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -94,6 +94,16 @@ extern void fl_trigger_clipboard_notify(int source);
extern HBRUSH fl_brush_action(int action);
extern void fl_cleanup_pens(void);
+// MSVC 2010 can't find round() although <math.h> is included above,
+// which is surprising because ceil() works fine.
+// We could (should?) probably add configure/CMake feature tests for
+// round() and ceil() rather than depending on MSVC version numbers.
+// AlbrechtS, 02/2010 - Note: we don't know about MSVC 2012 - 2015, see
+// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
+
+#if defined(_MSC_VER) && _MSC_VER <= 1600
+#define round(A) int((A) + 0.5)
+#endif // _MSC_VER <= 1600
//
// USE_ASYNC_SELECT - define it if you have WSAAsyncSelect()...