Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Compiling C++ without CMAKE with CGAL

Subject: CGAL users discussion list

List archive

[cgal-discuss] Compiling C++ without CMAKE with CGAL


Chronological Thread 
  • From: Brian Sanjeewa Rupasinghe <>
  • To:
  • Subject: [cgal-discuss] Compiling C++ without CMAKE with CGAL
  • Date: Fri, 20 May 2011 22:18:42 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Keb03DNklAR26fbcafHi/wdyedonJnLBs2JIE+2eIh7N3jjF5om+N+KZ63snKpBYgb 6yPaBWdDxWZDQDpiNGh2zWi1sPHQL3tRG36nQfmfMuz50UJBtd7eXW9BMcTGbfc68oYu 2Ptey3D5yeWcrhZmQUMfdGzxK/G8f8IqFlyg4=

Hello,

I created the CGAL library for Visual c++ 2008. Now i need to create a new program for Voronoi without CMAKE.
This is the .CPP file of my application.

#include "stdafx.h"
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>

#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;

typedef CGAL::Delaunay_triangulation_2<K>  Triangulation;
typedef Triangulation::Edge_iterator  Edge_iterator;
typedef Triangulation::Point          Point;

int _tmain()
{
std::ifstream in("data/voronoi.cin");
  std::istream_iterator<Point> begin(in);
  std::istream_iterator<Point> end;
  Triangulation T;
  T.insert(begin, end);

  int ns = 0;
  int nr = 0;
  Edge_iterator eit =T.edges_begin();
  for ( ; eit !=T.edges_end(); ++eit) {
    CGAL::Object o = T.dual(eit);
    if (CGAL::object_cast<K::Segment_2>(&o)) {++ns;}
    else if (CGAL::object_cast<K::Ray_2>(&o)) {++nr;}
  }
  std::cout << "The Voronoi diagram has " << ns << " finite edges "
            << " and " << nr << " rays" << std::endl;
return 0;
}

I followed the procedure given below after creating a new project. However, when the project is compiled it gives an
error: "fatal error LNK1104: cannot open file 'libgmp-10.lib;libmpfr-4.lib'. Any solution for this?

Brian.

Customizing env - If you are not using CMake to create new VS projects
 - Go to Tools -> Options -> Projects and Solutions -> VC++ Directories. Add the following to "Include files" (include) and "Library files" (library) [under "show directories for"].
   * include: <Boost> (C:\Program Files\boost\boost_1_44)
   * include: <CGAL>\include (C:\Program Files\CGAL-3.7\include)
   * include: <CGAL>\auxiliary\gmp\include (C:\Program Files\CGAL-3.7\auxiliary\gmp\include)
   * include: <QT>\include (C:\Qt\4.7.1\include)
   * include: <QT>\include\QtCore (C:\Qt\4.7.1\include\QtCore)
   * include: <QT>\include\QtGui (C:\Qt\4.7.1\include\QtGui)
 
   * library: <CGAL>\lib (C:\Program Files\CGAL-3.7\lib)
   * library: <QT>\lib (C:\Qt\4.7.1\lib)
   * library: <Boost>\lib (C:\Program Files\boost\boost_1_44\lib)
   * library: <CGAL>\auxiliary\gmp\lib (C:\Program Files\CGAL-3.7\auxiliary\gmp\lib)
   
For a specific project using CGAL you need to ignore the auto-link of gmp and mpfr. The names below are for Debug. In Release their names are a bit different.
 - Project Propeties -> Linker -> Input
   * Add libgmp-10.lib and libmpfr-4.lib to "Additional Dependencies"
   * Add gmp-vc90-mt-gd.lib and mpfr-vc90-mt-gd.lib to "Ignore Specific Library".


  • [cgal-discuss] Compiling C++ without CMAKE with CGAL, Brian Sanjeewa Rupasinghe, 05/20/2011

Archive powered by MHonArc 2.6.16.

Top of Page