0

I am using CGAL and I have this minimal example (which should be fine since it's an example):

#include <iostream>
#include <vector>
#include <CGAL/Cartesian_d.h>
#include <CGAL/point_generators_d.h>
typedef CGAL::Cartesian_d<double> Kd;
typedef Kd::Point_d Point;
typedef CGAL::Creator_uniform_d<std::vector<double>::iterator, Point>Creator_d;
int main ()
{
  int nb_points = 10;
  int dim =5;
  double size = 100.0;
  std::cout << "Generating "<<nb_points<<" random points in a"
    <<" ball in "<<dim<<"D of center 0 and radius "<<size<<std::endl;
  std::vector<Point> v;
  v.reserve (nb_points);
  CGAL::Random_points_in_ball_d<Point> gen (dim, 100.0);
  for (int i = 0; i < nb_points; ++i) v.push_back (*gen++);
  for (int i = 0; i < nb_points; ++i) std::cout<<" "<<v[i]<<std::endl;
  return 0;
}

However, I am getting this error:

samaras@samaras-A15:~/code/random_generator$ make
Scanning dependencies of target main
[100%] Building CXX object CMakeFiles/main.dir/main.cpp.o
make[2]: *** No rule to make target `/usr/lib/i386-linux-gnu/libmpfr.so', needed by `main'.  Stop.
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2

What I should do?

I am creating the CmakeLists files like this:

~/code/CGAL-4.3/scripts/cgal_create_CMakeLists
cmake -DCGAL_DIR=$HOME/code/CGAL-4.3 .

as I describe here.

If you need more information, please let me know.

--

cd /usr/lib/i386-linux-gnu/libmpfr.so
bash: cd: /usr/lib/i386-linux-gnu/libmpfr.so: No such file or directory
gsamaras
  • 71,951
  • 46
  • 188
  • 305

2 Answers2

3

The easiest way to install CGAL on Debian or Ubuntu is apt-get install libcgal-dev (or libcgal-qt4-dev). If you are going to build CGAL yourself, you should still apt-get build-dep cgal which installs the most relevant dependencies.

Marc Glisse
  • 7,550
  • 2
  • 30
  • 53
  • Marc thanks for the answer, it deserves a +1. However, I am not accepting it, since it is more general, while the other answer ( mine :) ) is more concrete. Just for future readers: I built CGAL like I describe here: https://gsamaras.wordpress.com/code/linux-and-cgal/. And of course there is the installation manual from CGAL: http://doc.cgal.org/latest/Manual/installation.html – gsamaras Mar 30 '15 at 12:21
1

The library was missing after all, so I did this and we are OK:

sudo apt-get install libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg

Source

Community
  • 1
  • 1
gsamaras
  • 71,951
  • 46
  • 188
  • 305