]> sigrok.org Git - pulseview.git/commitdiff
win32: Fix the Windows build (namespace pollution via windows.h).
authorVladislav Ivanov <redacted>
Thu, 26 Feb 2015 18:29:59 +0000 (21:29 +0300)
committerUwe Hermann <redacted>
Fri, 27 Feb 2015 10:33:15 +0000 (11:33 +0100)
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.

pv/session.hpp
pv/view/rowitemiterator.hpp

index 0f904d0d1cf300cf406b75d4751b46a5b3ed67a5..d71b1d6cec3f267bab7044b52dd69d375a1987a3 100644 (file)
 #include <thread>
 #include <vector>
 
+#ifdef _WIN32
+// Windows: Avoid namespace pollution by thread.hpp (which includes windows.h).
+#define NOGDI
+#define NORESOURCE
+#endif
 #include <boost/thread.hpp>
 
 #include <QObject>
index c45507bbb3de46a2545ead04b2d33df1e0d01e4c..1b8926ca90a0d35a2df9c20b6d44cf0165f57393 100644 (file)
 #include <type_traits>
 #include <vector>
 
+#ifdef _WIN32
+// Windows: Avoid namespace pollution by thread.hpp (which includes windows.h).
+#define NOGDI
+#define NORESOURCE
+#endif
 #include <boost/thread.hpp>
 
 #include <pv/session.hpp>