Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] multiple definitions problem

Subject: CGAL users discussion list

List archive

[cgal-discuss] multiple definitions problem


Chronological Thread 
  • From: Michael Jäntsch <>
  • To:
  • Subject: [cgal-discuss] multiple definitions problem
  • Date: Mon, 06 Sep 2010 12:51:19 +0200

Hello everyone,

I'm new to the list as I just started using CGAL last week. I also did manage to implement my quadratic program without trouble with CGAL, but now I'm experiencing some trouble. Maybe someone can help me.

Basically the linker complains about multiply defined functions, which seems absolutely correct as the functions are defined in .h files (. I already looked at the archives and I found a similar problem reported twice:
https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2007-01/msg00023.html
https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2007-01/msg00020.html

First one was in 2007 and seems to be resolved in the newer version of CGAL but then the same problem appeared with different functions later. Generally it seems like in CGAL there is a general problem of non-template functions being defined in headers. When those headers are then included in e.g multible cpp's and linked later on there will always be a problem, or am I missing something??? How are other people using this???

The error can be reproduced by having two cpp's both containig #include <CGAL/QP_functions.h>
This will cause the linker error:

CMakeFiles/testForceOptimization.dir/__/EnergyMinimization.cpp.o: In function `CGAL::operator<<(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Quadratic_program_options const&)':
/usr/include/c++/4.4/new:101: multiple definition of `CGAL::operator<<(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Quadratic_program_options const&)'
CMakeFiles/testForceOptimization.dir/__/EuclidianMinimization.cpp.o:/usr/include/c++/4.4/new:101: first defined here
CMakeFiles/testForceOptimization.dir/__/EnergyMinimization.cpp.o: In function `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<true>, CGAL::Boolean_tag<true>)':
/usr/local/include/CGAL/QP_functions.h:61: multiple definition of `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<true>, CGAL::Boolean_tag<true>)'
CMakeFiles/testForceOptimization.dir/__/EuclidianMinimization.cpp.o:/usr/local/include/CGAL/QP_functions.h:61: first defined here
CMakeFiles/testForceOptimization.dir/__/EnergyMinimization.cpp.o: In function `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<false>, CGAL::Boolean_tag<true>)':
/usr/local/include/CGAL/QP_functions.h:67: multiple definition of `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<false>, CGAL::Boolean_tag<true>)'
CMakeFiles/testForceOptimization.dir/__/EuclidianMinimization.cpp.o:/usr/local/include/CGAL/QP_functions.h:67: first defined here
CMakeFiles/testForceOptimization.dir/__/EnergyMinimization.cpp.o: In function `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<true>, CGAL::Boolean_tag<false>)':
/usr/local/include/CGAL/QP_functions.h:73: multiple definition of `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<true>, CGAL::Boolean_tag<false>)'
CMakeFiles/testForceOptimization.dir/__/EuclidianMinimization.cpp.o:/usr/local/include/CGAL/QP_functions.h:73: first defined here
CMakeFiles/testForceOptimization.dir/__/EnergyMinimization.cpp.o: In function `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false>)':
/usr/local/include/CGAL/QP_functions.h:79: multiple definition of `CGAL::QP_functions_detail::print_solution_function(std::basic_ostream<char, std::char_traits<char> >&, CGAL::Boolean_tag<false>, CGAL::Boolean_tag<false>)'
CMakeFiles/testForceOptimization.dir/__/EuclidianMinimization.cpp.o:/usr/local/include/CGAL/QP_functions.h:79: first defined here
collect2: ld returned 1 exit status



I'm not sure how to resolve this. Could somebody please help me?
regards
Michael

--
Technische Universität München
Michael Jäntsch
Fakultät für Informatik
Robotics and Embedded Systems
Parkring 13
85748 Garching bei München
Tel: + 49.89.289.17626
Fax: + 49.89.289.17637

www6.in.tum.de





Archive powered by MHonArc 2.6.16.

Top of Page