From: Vladislav Ivanov Date: Thu, 26 Feb 2015 18:29:59 +0000 (+0300) Subject: win32: Fix the Windows build (namespace pollution via windows.h). X-Git-Tag: pulseview-0.3.0~233 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=627ffe3f3a5d0a8f38e35668bd4ed71321f09b91 win32: Fix the Windows build (namespace pollution via windows.h). One of the multiple build errors: In file included from [...]/windows.h:72:0, from [...]/boost/detail/interlocked.hpp:27, from [...]/boost/thread/win32/thread_primitives.hpp:18, from [...]/boost/thread/win32/thread_data.hpp:11, from [...]/boost/thread/thread_only.hpp:15, from [...]/boost/thread/thread.hpp:12, from [...]/boost/thread.hpp:13, from [...]/pulseview/pv/session.hpp:32, from [...]/pulseview/pv/devicemanager.cpp:22: [...]/libsigrok/enums.hpp:153:32: error: expected unqualified-id before numeric constant static const Quantity * const DIFFERENCE; ^ windows.h is included by boost/thread.hpp, hence the conflict can be avoided by defining NOGDI and NORESOURCE before including thread.hpp. This fixes bug #517. --- diff --git a/pv/session.hpp b/pv/session.hpp index 0f904d0d..d71b1d6c 100644 --- a/pv/session.hpp +++ b/pv/session.hpp @@ -29,6 +29,11 @@ #include #include +#ifdef _WIN32 +// Windows: Avoid namespace pollution by thread.hpp (which includes windows.h). +#define NOGDI +#define NORESOURCE +#endif #include #include diff --git a/pv/view/rowitemiterator.hpp b/pv/view/rowitemiterator.hpp index c45507bb..1b8926ca 100644 --- a/pv/view/rowitemiterator.hpp +++ b/pv/view/rowitemiterator.hpp @@ -29,6 +29,11 @@ #include #include +#ifdef _WIN32 +// Windows: Avoid namespace pollution by thread.hpp (which includes windows.h). +#define NOGDI +#define NORESOURCE +#endif #include #include