title: Compiling boost::geometry polygon
body: <p>I'm trying to use boost::geometry polygon class to calculate intersections and their areas.
  I have my own 3d piont class, with which I define a polygon. However, when I try to use area() or intersection() I get many compilation errors.</p>
  
  <p>I know I'm missing some definitions, or some extra REGISTER macros, but I don't know which.</p>
  
  <p>I'm using boost 1.54, VC++ 2010 express.</p>
  
  <p>Below is a simple program which doesn't compile. How do I make it compile?</p>
  
  <pre><code>#include &lt;boost/geometry.hpp&gt;
  #include &lt;boost/geometry/geometry.hpp&gt; 
  #include &lt;boost/geometry/geometries/polygon.hpp&gt;
  #include &lt;boost/geometry/geometries/register/point.hpp&gt; 
  #include &lt;boost/geometry/geometries/register/ring.hpp&gt; 
  
  struct MyPoint
  {
      double x, y, z;
  };
  
  typedef boost::geometry::model::polygon&lt;MyPoint&gt; Polygon;
  
  BOOST_GEOMETRY_REGISTER_POINT_3D(MyPoint, double, boost::geometry::cs::cartesian, x, y, z);
  BOOST_GEOMETRY_REGISTER_RING(Polygon::ring_type);
  
  inline void addPoint(Polygon&amp; poly, double x, double y, double z)
  {
      MyPoint p;
      p.x = x; p.y = y; p.z = z;
      boost::geometry::append(poly, p);
  }
  
  int main()
  {
      Polygon poly1;
      addPoint(poly1, 2, 0, 0);
      addPoint(poly1, 2, 2, 0);
      addPoint(poly1, 0, 2, 0);
      addPoint(poly1, 0, 0, 0);
      addPoint(poly1, 2, 0, 0);
  
      Polygon poly2;
      addPoint(poly2, 3, 0, 0);
      addPoint(poly2, 3, 3, 0);
      addPoint(poly2, 0, 3, 0);
      addPoint(poly2, 0, 0, 0);
      addPoint(poly2, 3, 0, 0);
  
      Polygon intersectionPoly;
      boost::geometry::intersection(poly1, poly2, intersectionPoly);
  
      std::cout &lt;&lt; "Intersection polygon area is " &lt;&lt; boost::geometry::area(intersectionPoly) &lt;&lt; '\n';
  }
  </code></pre>
  
  <p>Compilation errors:</p>
  
  <pre><code>1&gt;------ Build started: Project: TestPolygon, Configuration: Debug Win32 ------
  1&gt;  main.cpp
  1&gt;c:\dev\externals\boost_1_54_0\boost\range\iterator.hpp(63): error C2039: 'type' : is not a member of 'boost::mpl::eval_if_c&lt;C,F1,F2&gt;'
  1&gt;          with
  1&gt;          [
  1&gt;              C=false,
  1&gt;              F1=boost::range_const_iterator&lt;boost::geometry::model::polygon&lt;MyPoint&gt;&gt;,
  1&gt;              F2=boost::range_mutable_iterator&lt;Polygon&gt;
  1&gt;          ]
  1&gt;          c:\dev\externals\boost_1_54_0\boost\range\value_type.hpp(30) : see reference to class template instantiation 'boost::range_iterator&lt;C&gt;' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              C=Polygon
  1&gt;          ]
  1&gt;          c:\dev\externals\boost_1_54_0\boost\geometry\algorithms\intersection.hpp(97) : see reference to class template instantiation 'boost::range_value&lt;T&gt;' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              T=Polygon
  1&gt;          ]
  1&gt;          c:\dev\externals\boost_1_54_0\boost\geometry\algorithms\intersection.hpp(201) : see reference to function template instantiation 'bool boost::geometry::dispatch::intersection&lt;Geometry1,Geometry2&gt;::apply&lt;GeometryOut,boost::geometry::strategy_intersection&lt;Tag,Geometry1,Geometry2,IntersectionPoint&gt;&gt;(const Geometry1 &amp;,const Geometry2 &amp;,GeometryOut &amp;,const Strategy &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              Geometry1=Polygon,
  1&gt;              Geometry2=Polygon,
  1&gt;              GeometryOut=Polygon,
  1&gt;              Tag=boost::geometry::cartesian_tag,
  1&gt;              IntersectionPoint=MyPoint,
  1&gt;              Strategy=boost::geometry::strategy_intersection&lt;boost::geometry::cartesian_tag,Polygon,Polygon,MyPoint&gt;
  1&gt;          ]
  1&gt;          c:\test\main.cpp(45) : see reference to function template instantiation 'bool boost::geometry::intersection&lt;Polygon,Polygon,Polygon&gt;(const Geometry1 &amp;,const Geometry2 &amp;,GeometryOut &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              Geometry1=Polygon,
  1&gt;              Geometry2=Polygon,
  1&gt;              GeometryOut=Polygon
  1&gt;          ]
  1&gt;c:\dev\externals\boost_1_54_0\boost\range\value_type.hpp(30): error C3203: 'type' : unspecialized class template can't be used as a template argument for template parameter 'Iterator', expected a real type
  1&gt;c:\dev\externals\boost_1_54_0\boost\range\value_type.hpp(30): error C2955: 'boost::type' : use of class template requires template argument list
  1&gt;          c:\dev\externals\boost_1_54_0\boost\type.hpp(14) : see declaration of 'boost::type'
  1&gt;c:\dev\externals\boost_1_54_0\boost\range\value_type.hpp(31): error C2955: 'boost::iterator_value' : use of class template requires template argument list
  1&gt;          c:\dev\externals\boost_1_54_0\boost\iterator\iterator_traits.hpp(29) : see declaration of 'boost::iterator_value'
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(21): error C2039: 'const_reference' : is not a member of 'boost::geometry::model::polygon&lt;Point&gt;'
  1&gt;          with
  1&gt;          [
  1&gt;              Point=MyPoint
  1&gt;          ]
  1&gt;          c:\dev\externals\boost_1_54_0\boost\geometry\algorithms\intersection.hpp(103) : see reference to class template instantiation 'std::back_insert_iterator&lt;_Container&gt;' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Container=Polygon
  1&gt;          ]
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(21): error C2146: syntax error : missing ';' before identifier 'const_reference'
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(21): error C2602: 'std::back_insert_iterator&lt;_Container&gt;::const_reference' is not a member of a base class of 'std::back_insert_iterator&lt;_Container&gt;'
  1&gt;          with
  1&gt;          [
  1&gt;              _Container=Polygon
  1&gt;          ]
  1&gt;          d:\program files\microsoft visual studio 10.0\vc\include\iterator(21) : see declaration of 'std::back_insert_iterator&lt;_Container&gt;::const_reference'
  1&gt;          with
  1&gt;          [
  1&gt;              _Container=Polygon
  1&gt;          ]
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(21): error C2868: 'std::back_insert_iterator&lt;_Container&gt;::const_reference' : illegal syntax for using-declaration; expected qualified-name
  1&gt;          with
  1&gt;          [
  1&gt;              _Container=Polygon
  1&gt;          ]
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(22): error C2039: 'value_type' : is not a member of 'boost::geometry::model::polygon&lt;Point&gt;'
  1&gt;          with
  1&gt;          [
  1&gt;              Point=MyPoint
  1&gt;          ]
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(29): error C2182: '_Val' : illegal use of type 'void'
  1&gt;d:\program files\microsoft visual studio 10.0\vc\include\iterator(35): error C2182: '_Val' : illegal use of type 'void'
  1&gt;c:\dev\externals\boost_1_54_0\boost\geometry\algorithms\intersection.hpp(103): error C2064: term does not evaluate to a function taking 4 arguments
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>