2015-11-18 52 views
0

OS X埃爾卡皮坦10.11.2 安裝CGAL庫(2.3.4版本)如何在Mac上編譯CGAL程序?通過MacPorts的

我有一個文件(/Users/Arseniy/Desktop/vec.cpp):

#include <iostream> 
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> 
#include <CGAL/convex_hull_2.h> 
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; 
typedef K::Point_2 Point_2; 
int main() 
{ 
    Point_2 points[5] = { Point_2(0,0), Point_2(10,0), Point_2(10,10), Point_2(6,5), Point_2(4,1) }; 
    Point_2 result[5]; 
    Point_2 *ptr = CGAL::convex_hull_2(points, points+5, result); 
    std::cout << ptr - result << " points on the convex hull:" << std::endl; 
    for(int i = 0; i < ptr - result; i++){ 
    std::cout << result[i] << std::endl; 
    } 
    return 0; 
} 

而且我找到了CGAL庫的頭文件(/ usr/local/include/CGAL)。我發現錯誤: 「ld:library not found for --dll」找不到ld:找不到庫文件,找不到 - lCGAL 鐺:錯誤:連接命令,退出代碼爲1(使用-v看看調用)失敗

我是很新,GCC這個問題似乎很容易給你,但我在這裏學習

感謝您的關注和幫助!

+0

因此,我用CGAL庫的h文件將文件vec.cpp替換爲(/ usr/local/include/CGAL)文件夾。現在gcc只給我一個錯誤:vec.cpp:2:10:致命錯誤: 'CGAL/Exact_predicates_inexact_constructions_kernel.h'文件未找到 #include 但是這個文件實際上存在。 ^ 生成1個錯誤。 –

回答

0

我認爲Pods沒有包含在構建中

你能檢查xcode中的pod根路徑嗎?要做到這一點,請單擊「豆莢」>構建設置>在哪裏看到「PODS_ROOT」雙擊的是,它表明類似

$ {} SRCROOT莢/../

如果一切正常,這個問題將是莢沒有被安裝,運行安裝豆莢(POD安裝) 更多參考使用這個鏈接 http://www.binpress.com/tutorial/cocoapods-dependancy-management-for-xcode/139

很抱歉,如果這不解決您的問題。

0

您需要使用-L選項向鏈接器提供CGAL庫的路徑。你也可能錯過了-frounding-math標誌。 CGAL建議使用cmake。