From 374232e2f483119ef73a59159c885b483cc9325a Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 7 May 2021 15:48:24 +0200 Subject: 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). --- src/Fl_win32.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 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()... -- cgit v1.2.3