[PATCH 4/7] libdivecomputer.h: fix warning with DC_VERSION on Win32

Lubomir I. Ivanov neolit123 at gmail.com
Wed Nov 18 13:46:57 PST 2015


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

"warning: "DC_VERSION" redefined" is thrown if a chain of
includes previously includes windows.h:

In file included from c:/bin/mingw/i686-w64-mingw32/include/windows.h:71:0,
    from C:/bin/qt/5.5/mingw492_32/include/QtCore/qt_windows.h:63,
    from C:/bin/qt/5.5/mingw492_32/include/QtGui/qopengl.h:43,
    from C:/bin/qt/5.5/mingw492_32/include/QtQuick/qquickwindow.h:39,
    from C:/bin/qt/5.5/mingw492_32/include/QtQuick/QQuickWindow:1,
    from C:/dev/subsurface/subsurface-core/qt-gui.h:13,
    from C:\dev\subsurface\subsurface-mobile-main.cpp:9:

and which on it's own includes wingdi.h which defines
"DC_VERSION 10" (windows printer stack related).

To solve the warning DC_VERSION is undefined in
subsurface-core/libdivecomputer.h.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---

quite odd that i see this one for the first time.
---
 subsurface-core/libdivecomputer.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/subsurface-core/libdivecomputer.h b/subsurface-core/libdivecomputer.h
index 79817e5..f52f695 100644
--- a/subsurface-core/libdivecomputer.h
+++ b/subsurface-core/libdivecomputer.h
@@ -3,6 +3,10 @@
 
 
 /* libdivecomputer */
+
+#ifdef DC_VERSION /* prevent a warning with wingdi.h */
+#undef DC_VERSION
+#endif
 #include <libdivecomputer/version.h>
 #include <libdivecomputer/device.h>
 #include <libdivecomputer/parser.h>
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list