簡體   English   中英

如何在Mac上編譯CGAL程序?

[英]How to compile CGAL programs on Mac?

OS X El Capitan 10.11.2通過macports安裝的CGAL庫(版本2.3.4)

我有一個文件(/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)。

當我嘗試在終端(g ++ -0 vec vec.cpp -lCGAL -I / usr / local / include / CGAL)中通過g ++進行編譯時,我看到了錯誤:“ ld:找不到用於-lCGAL clang的庫:錯誤:鏈接器命令失敗,退出代碼為1(使用-v查看調用)。

我是gcc的新手。 這個問題對您來說似乎很容易,但是我在這里學習。

感謝您的關注和幫助!

我認為Pod沒有包含在構建中。

您可以在xcode中檢查pods根路徑嗎? 為此,請單擊“窗格”>“構建設置”>,然后雙擊“ PODS_ROOT”,顯示類似

$ {SRCROOT} /../ Pods

如果一切正常,則問題可能是未安裝Pod,請運行pods install(pod install)以獲取更多參考,請使用此鏈接http://www.binpress.com/tutorial/cocoapods-dependency-management-for-xcode / 139

對不起,如果這樣不能解決您的問題。

您需要使用-L選項為鏈接器提供CGAL庫的路徑。 您可能還缺少-frounding-math標志。 CGAL建議使用cmake。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM