Opened 8 years ago
Last modified 8 years ago
#10471 new Bugs
Boost.Geometry fails to compile when OS X AssertMacros.h are included
| Reported by: | Owned by: | Barend Gehrels | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | geometry |
| Version: | Boost 1.55.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
The infamous AssertMacros.h header (see #2115) defines a macro called "check", which causes a compilation failure in <boost/geometry/geometries/concepts/check.hpp>. The header is automatically included by certain Apple frameworks, so it's a bit unavoidable.
Per the resolution to #2115, instances of the word "check" should be replaced by something else to avoid this issue. (Damn you, Apple...)
Testcase program:
#include <AssertMacros.h> #include <boost/geometry.hpp>
Compile with "c++ test.cpp". Compile errors:
In file included from test.cpp:2:
In file included from /opt/local/include/boost/geometry.hpp:17:
In file included from /opt/local/include/boost/geometry/geometry.hpp:43:
In file included from /opt/local/include/boost/geometry/strategies/strategies.hpp:31:
In file included from /opt/local/include/boost/geometry/strategies/intersection.hpp:15:
In file included from /opt/local/include/boost/geometry/policies/relate/intersection_points.hpp:19:
In file included from /opt/local/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp:20:
/opt/local/include/boost/geometry/geometries/concepts/check.hpp:217:1: error:
expected unqualified-id
{
^
In file included from test.cpp:2:
In file included from /opt/local/include/boost/geometry.hpp:17:
In file included from /opt/local/include/boost/geometry/geometry.hpp:43:
In file included from /opt/local/include/boost/geometry/strategies/strategies.hpp:31:
In file included from /opt/local/include/boost/geometry/strategies/intersection.hpp:15:
In file included from /opt/local/include/boost/geometry/policies/relate/intersection_points.hpp:19:
In file included from /opt/local/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp:21:
In file included from /opt/local/include/boost/geometry/algorithms/detail/assign_values.hpp:29:
/opt/local/include/boost/geometry/algorithms/append.hpp:217:9: error: no
template named 'check' in namespace 'boost::geometry::concept'; did you
mean 'dispatch::check'?
concept::check<Geometry>();
^~~~~~~~~~~~~~
dispatch::check
/opt/local/include/boost/geometry/geometries/concepts/check.hpp:68:8: note:
'dispatch::check' declared here
struct check : not_implemented<GeometryTag>
^
... more errors about missing concept::check ...
Note:
See TracTickets
for help on using tickets.

In the cited Apple header file AssertMacros.h there is a note that defining the macro __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES as 0 will suppress the definition of the conflicting macro names, in favor of more portable names (e.g. __Check). (It is further noted that this will be the default in a future version of AssertMacros.h; until then the recommendation is for the user to add this definition to their compiler options.)
Perhaps documenting this workaround will be adequate.