0

OS X El Capitan 10.11.2 Installed CGAL library via macports (version 2.3.4)

I have a file (/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;
}

Also i found headers of CGAL library (/usr/local/include/CGAL).

And when i tried to compile it via g++ in terminal (g++ -0 vec vec.cpp -lCGAL -I/usr/local/include/CGAL) I see the error: "ld: library not found for -lCGAL clang: error: linker command failed with exit code 1 (use -v to see invocation).

I'm pretty new to gcc. This problem may seem easy to you but I am here to learn.

Thank you for your attention and your help!

Arseniy Spiridonov
  • 337
  • 1
  • 2
  • 16
  • So, i replaced the file vec.cpp into (/usr/local/include/CGAL) the folder with h-files of CGAL library. And now gcc send me only the one error: vec.cpp:2:10: fatal error: 'CGAL/Exact_predicates_inexact_constructions_kernel.h' file not found #include But this file actually exists. ^ 1 error generated. – Arseniy Spiridonov Nov 18 '15 at 13:14

2 Answers2

0

I Think Pods isn't being included in the build.

Can you check the pods root path in xcode please? To do this, click "pods" > build settings > and where you see "PODS_ROOT" double click that, which show something like

${SRCROOT}/../Pods

If everything is fine, the issue will be pods isn't being installed, run pods install ( pod install) For further reference use this link http://www.binpress.com/tutorial/cocoapods-dependancy-management-for-xcode/139

Sorry If this Doesn't Solves your problem.

Murali Manohar
  • 589
  • 7
  • 35
0

You need to provide the linker the path to the CGAL library using the -L option. You are also probably missing the -frounding-math flag. CGAL recommends to use cmake.

sloriot
  • 6,070
  • 18
  • 27