Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Compile time error

Subject: CGAL users discussion list

List archive

[cgal-discuss] Compile time error


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] Compile time error
  • Date: Wed, 29 Jul 2009 14:48:48 +0200 (CEST)

Hello everyone.

I'm having some trouble trying to compile a program that uses cgal in VC 2008,
under WinXp. More specifically, the QP part of the library.

I've written some c++ code that invokes the quadratic programming solver built
in cgal.


In the .h part I have :

#ifndef SIMPLE_SVM_H
#define SIMPLE_SVM_H
//--------------------------------------------------------------------
#include <CGAL/basic.h>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
//--------------------------------------------------------------------
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz ET;
#else
#include <CGAL/MP_Float.h>
typedef CGAL::MP_Float ET;
#endif
//--------------------------------------------------------------------
typedef CGAL::Quadratic_program<int> QProgram;
typedef CGAL::Quadratic_program_solution<ET> QSolution;
//--------------------------------------------------------------------
#endif //SIMPLE_H

In the .c part, I declare:

QProgram qp(CGAL::EQUAL, true, 0, false, 0);
QSolution sol;

and then use some of the functions from these classes. When I try to build the
program, the linker complains about multiple definitions in a file that
includes "simple.h" e.g.

simple_svm.obj : error LNK2005: "class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl CGAL::operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,class
CGAL::Quadratic_program_options const &)"
(??6CGAL@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABVQuadratic_program_options@0@@Z)
already defined in GeneralManager.obj

simple_svm.obj : error LNK2005: "void __cdecl
CGAL::QP_functions_detail::print_solution_function(class
std::basic_ostream<char,struct std::char_traits<char> > &,struct
CGAL::Boolean_tag<1>,struct CGAL::Boolean_tag<1>)"
(?print_solution_function@QP_functions_detail@CGAL@@YAXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@U?$Boolean_tag@$00@2@1@Z)
already defined in GeneralManager.obj

By the looks of it, my noobish nature is to blame and perhaps I've forgotten
some defines... Can anyone help?


  • [cgal-discuss] Compile time error, andreisucila, 07/29/2009

Archive powered by MHonArc 2.6.16.

Top of Page