Subject: CGAL users discussion list
List archive
- From: Martin Baeker <>
- To: CGAL Mailinglist <>
- Subject: Namespace problems with function name distance
- Date: Wed, 19 Sep 2007 15:08:12 +0200 (CEST)
- Organization: Institut fuer Werkstoffe TU Braunschweig
Dear experts,
I just tried to upgrade from CGAL 3.1 to 3.3. (SuSe Linux 10.1 with
g++ (GCC) 4.1.0 (SUSE Linux)) However, I encounter some strange
behaviour when trying to define a function that is named "distance"
#include <iostream>
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/MP_Float.h>
typedef CGAL::Quotient<CGAL::MP_Float> NT;
typedef CGAL::Cartesian<NT> TutorialR;
typedef CGAL::Point_2<TutorialR> Point;
double distance(const Point & p, const Point & q)
{
return sqrt(CGAL::to_double(squared_distance(p,q )));
}
int main()
{
Point p1(1.,2.);
Point p2(2.,2.);
std::cout << (distance(p1,p2)) << std::endl;
return 0;
}
On compiling this, I get
/usr/bin/g++ -Wall -frounding-math
'-I/home/gecko/martin/fem/abaqus/CGAL-3.3.1/include/CGAL/config/i686_Linux-2.6_g++-4.1.0'
'-I/home/gecko/martin/fem/abaqus/CGAL-3.3.1/include' -I/usr/X11/include
-I/usr/lib/qt3/include -g -c -o minitest.o minitest.C
/usr/include/c++/4.1.0/bits/stl_iterator_base_types.h: In instantiation of
»std::iterator_traits<CGAL::Point_2<CGAL::Cartesian<CGAL::Quotient<CGAL::MP_Float>
> > >«:
minitest.C:18: instantiated from here
/usr/include/c++/4.1.0/bits/stl_iterator_base_types.h:129: Fehler: kein Typ
namens »iterator_category« in »class
CGAL::Point_2<CGAL::Cartesian<CGAL::Quotient<CGAL::MP_Float> > >«
As it seems, the function I defined is confused with the std::distance
function, but I do not understand how this happens. If I do the same
thing replacing the Point class with simple doubles, all is well.
Any help, hints, etc are very welcome,
Martin.
Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
<>
- Namespace problems with function name distance, Martin Baeker, 09/19/2007
- Re: [cgal-discuss] Namespace problems with function name distance, Bernd Gaertner, 09/20/2007
Archive powered by MHonArc 2.6.16.