2012-12-12 2 views
2

이전에는 일부 프로그램을 작성하기 위해 GGL 라이브러리를 사용합니다. 예를 들어, 다음 코드는 GGL과 구 버전의 gcc에서 잘 작동합니다. 이제 gcc를 gcc4.7.1로 업데이트합니다. 내 프로그램은 컴파일하는 동안 오류가 발생합니다. 따라서, 나는 boost 1.52.1의 최신 버전으로 업데이트한다. point_2d, polygon_2d 등과 관련된 오류가 여전히 있습니다. 'vesion boost'에서 'cartesian2d.hpp', 'c_array_cartesian.hpp'와 같은 일부 파일이 누락되었습니다.최신 버전의 부스트 및 부스트 지오메트리 라이브러리 (GGL) 간의 충돌

누군가 다음 코드를 분석하고 문제점을 알려줄 수 있습니까? 고마워.

#include <iostream> 

#include <boost/geometry.hpp> 
#include <boost/geometry/geometries/point_xy.hpp> 
#include <boost/geometry/geometries/polygon.hpp> 
#include <boost/geometry/algorithms/distance.hpp> 
#include <boost/geometry/geometry.hpp> 

#include <algorithm> // for reverse, unique 
#include <iostream> 
#include <string> 


typedef boost::geometry::model::d2::point_xy<double,   
boost::geometry::cs::cartesian> point_2d; 
typedef boost::geometry::model::polygon<point_2d> polygon_2d; 
using namespace boost::geometry; 

int main() { 
     std::cout << "!!!Hello World!!!" << std::endl; // prints !!!Hello World!!! 
     model::d2::point_xy<int> p1(1.0, 1.0), p2(2.0, 2.0); 
     point_2d x(3.0,3.0); 
     std::cout << x.x(); 
     std::cout << "Distance p1-p2 is: " << distance(p1, p2) <<std::endl; 

     float width = 100; 
     float length = 100; 


     polygon_2d poly; 
     { 
      const float coor[][2] = { 
      {-350.0,-500.0}, {350,-500}, {350, 0}, {width/2.0, 0}, {width/2.0, length}, 
      {350, length}, {350, 1000}, {-350, 1000}, {-350, length}, {-1*width/2.0, length}, {-1*width/2.0,0}, 
      {-350, 0}, {-350.0,-500.0} // closing point is opening point 
      }; 
      assign(poly, coor); 
     } 
      correct(poly); 

     return 0; 
} 

오류는 다음과 같다 :

c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.1/ 
../../../../include/boost/geometry/core/point_order.hpp:1 
57:12: required from 'const boost::geometry::order_selector 
boost::geometry::point_order<float [13][2]>::value' 
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64- 
mingw32/4.7.1/../../../../include/boost/geometry/algorithms/ 
assign.hpp:148:70: required from 'void 
boost::geometry::assign(Geometry1&, const Geometry2&) [with 
Geometry1 =boost::geometry::model::polygon<boost::geometry::model 
::d2::point_xy<double, boost::geometry::cs::cartesian> >; 
Geometry2 = float [13][2]]' 
..\src\test.cpp:47:44: required from here 
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.1/ 
../../../../include/boost/geometry/core/point_order.hpp:95:5: 
error: no matching function for call to 
'assertion_failed(mpl_::failed************ 
(boost::geometry::core_dispatch::point_order<void, float [13] 
[2]>::NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE::************) 
(mpl_::assert_::types<float [13][2], mpl_::na, mpl_::na, 
mpl_::na>))' 
+0

고맙습니다. – Jun

답변

3

두 변화가 필요하다 :

1)가 CONST 플로트의 내부에 사용되는 2D 플로트 어레이 (적응, c_array.hpp 포함 [] [2])를 Boost.Geometry Point 개념 :

#include <boost/geometry/geometries/adapted/c_array.hpp> 

2) 할당 대신에 assign_points를 사용하십시오.

assign_points(poly, coor); 

코드가 컴파일됩니다. 배경 : 릴리스에서 사전 릴리스 버전 (물론 허용됨)을 사용 중이 었습니다. 인터페이스에서 작은 변경 사항이 릴리스되었습니다. assign (범위 포함)은 이제 assign_points라고합니다.

+0

제 질문은 여기를 참조하십시오. ? 때마다 내 코드를 컴파일 할 때 check_underflow 오류가 나타납니다,하지만 나는 무엇이 문제인지 몰라. 나는 부스트 1.52.0을 사용한다. 및 gcc4.7.1. 감사합니다 – Jun

+0

고마워, 알았다. 문제는 #define re 1을 사용하는 것입니다. 그러나 라이브러리에는 variant가 또한 're'입니다. – Jun