|
Boost Users : |
Subject: [Boost-users] [polygon] Compiling polygon under Windows
From: Josh Pieper (jpieper_at_[hidden])
Date: 2010-11-28 14:17:58
Hello,
I have been compiling boost::polygon under Windows (VS2008, MSVC9.0
specifically) and have run into a minor problem with boost::polygon's
detection of Microsoft's compiler. Specifically, it tests for the
WIN32 preprocessor define instead of _WIN32. WIN32 isn't actually
defined by the compiler, but by windows.h, and not all translation
units actually need to include that header. _WIN32 is defined by the
compiler, and boost has the similar BOOST_MSVC preprocessor define
which could also be used.
While there is some disagreement among the existing boost libraries
about the best mechanism to check this, some check _WIN32, some check
BOOST_MSVC, and some check both or others at the same time.
I propose the following patch to the 1.45.0 boost::polygon sources to
make the detection of the MSVC compiler more robust.
Regards,
Josh Pieper
Index: boost/polygon/gtl.hpp
===================================================================
--- boost/polygon/gtl.hpp
+++ boost/polygon/gtl.hpp
@@ -12,7 +12,7 @@
#pragma warning (disable:1125)
#endif
-#ifdef WIN32
+#ifdef _WIN32
#pragma warning( disable: 4996 )
#pragma warning( disable: 4800 )
#endif
Index: polygon/isotropy.hpp
===================================================================
--- boost/polygon/isotropy.hpp
+++ boost/polygon/isotropy.hpp
@@ -48,7 +48,7 @@
#include <boost/mpl/or.hpp>
#else
-#ifdef WIN32
+#ifdef _WIN32
#define BOOST_POLYGON_MSVC
#endif
#ifdef __ICC
@@ -290,7 +290,7 @@
template <typename T>
struct gtl_if {
-#ifdef WIN32
+#ifdef _WIN32
typedef gtl_no type;
#endif
};
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net