2012-02-07 1 views
1

이것은 CGAL 기본 웹 페이지에서 찾은 기본 예제입니다. 나는 다음과 같은 컴파일하려고 :Macports cgal이 작동하지 않습니다! 어떻게 수정해야합니까?

1 #include <iostream>                
    2 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>     
    3 #include <CGAL/convex_hull_2.h>             
    4                     
    5 typedef CGAL::Exact_predicates_inexact_constructions_kernel K;     
    6 typedef K::Point_2 Point_2;              
    7                     
    8 int main()                  
    9 {                    
10 Point_2 points[5] = { Point_2(0,0), Point_2(10,0), Point_2(10,10), Point_2(6,5), Point_2(4,1) }; 
11 Point_2 result[5];                
12                     
13 Point_2 *ptr = CGAL::convex_hull_2(points, points+5, result);    
14 std::cout << ptr - result << " points on the convex hull" << std::endl;  
15 return 0;                  
16 } 

하지만이 오류 얻을 : 나는 MacPorts를를 사용 CGAL를 설치

Demo $> make 
[100%] Building CXX object CMakeFiles/helloworld_cgal.dir/helloworld_cgal.cpp.o 
In file included from /opt/local/include/CGAL/Bbox_2.h:30, 
       from /opt/local/include/CGAL/basic_classes.h:30, 
       from /opt/local/include/CGAL/Cartesian/Cartesian_base.h:28, 
       from /opt/local/include/CGAL/Simple_cartesian.h:27, 
       from /opt/local/include/CGAL/Exact_predicates_inexact_constructions_kernel.h:27, 
       from /Users/carlos/Documents/Code/Demo/helloworld_cgal.cpp:2: 
/opt/local/include/CGAL/array.h:81: error: expected nested-name-specifier before ‘...’ token 
/opt/local/include/CGAL/array.h:81: error: expected ‘>’ before ‘...’ token 
/opt/local/include/CGAL/array.h:83: error: template argument 2 is invalid 
/opt/local/include/CGAL/array.h:84: error: expected ‘,’ or ‘...’ before ‘&’ token 
/opt/local/include/CGAL/array.h:84: error: ISO C++ forbids declaration of ‘Args’ with no type 
/opt/local/include/CGAL/array.h: In function ‘int CGAL::make_array(const T&, int)’: 
/opt/local/include/CGAL/array.h:86: error: template argument 2 is invalid 
/opt/local/include/CGAL/array.h:86: error: invalid type in declaration before ‘=’ token 
/opt/local/include/CGAL/array.h:86: error: ‘args’ was not declared in this scope 
/opt/local/include/CGAL/array.h:86: error: expected `}' before ‘...’ token 
/opt/local/include/CGAL/array.h:86: error: expected `}' before ‘...’ token 
/opt/local/include/CGAL/array.h:86: error: expected ‘,’ or ‘;’ before ‘...’ token 
/opt/local/include/CGAL/array.h: At global scope: 
/opt/local/include/CGAL/array.h:87: error: expected unqualified-id before ‘return’ 
/opt/local/include/CGAL/array.h:88: error: expected declaration before ‘}’ token 
make[2]: *** [CMakeFiles/helloworld_cgal.dir/helloworld_cgal.cpp.o] Error 1 
make[1]: *** [CMakeFiles/helloworld_cgal.dir/all] Error 2 
make: *** [all] Error 2 

합니다. 누구든지 이 무엇이 잘못 될 수 있는지 알고 있습니까?

+0

코드를 pastebin 대신 인라인으로 게시하십시오. 오류도 마찬가지입니다. –

+0

죄송합니다. 지원되는 인라인 코드를 모르겠습니다. 당신이 그것을 고치는 법을 안다면 저에게 알려주십시오 ... – newDelete

+1

CGAL을 만들기 위해 macport에 사용 된 컴파일러가 예제를 컴파일하는 데 사용되지 않을 수 있습니다. 당신이 가지고있는 오류는 가변적 인 템플릿 매개 변수들이 CGAL이 그것들과 함께 설정되어있는 동안 당신의 컴파일러에 의해 지원되지 않는다는 것입니다. – sloriot

답변

1

실제로 CGAL을 빌드하고 CGAL로 컴파일 할 때 사용되는 컴파일러 또는 컴파일러 옵션이 일치하지 않는 것처럼 보입니다. macports가 도움이되지 않을 수도 있습니다. 나는 CGAL을 설치할 때 macports보다 homebrew가 더 운 좋았습니다.