Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] pb with ofstream ?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] pb with ofstream ?


Chronological Thread 
  • From: "Laurent Rineau (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] pb with ofstream ?
  • Date: Wed, 25 Apr 2012 16:57:48 +0200
  • Organization: GeometryFactory

Le mercredi 25 avril 2012 06:35:12 gwenm a écrit :
> Hi all
> i tried to compile this short example cgal example
> #include <CGAL/basic.h>
> #include
> #include
> #include <CGAL/Cartesian.h>
> #include <CGAL/Segment_2.h>
> typedef CGAL::Point_2< CGAL::Cartesian > Point;
> typedef CGAL::Segment_2< CGAL::Cartesian > Segment;
> int main()
> {
> Point p(0,1), q(2,2);
> Segment s(p,q);
> CGAL::set_pretty_mode(std::cout);
> std::cout << p << std::endl << q << std::endl;
>
> std::ofstream f("data.txt"); //------------------>>>HERE
> CGAL::set_binary_mode(f);
> f << s << p ;
> return 1;
> }
> but the line annoted //>>>HERE sends an error LINK:
> msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: class
> std::basic_ostream<char,struct std::char_traits&lt;char> > & __thiscall
> std::basic_ostream<char,struct std::char_traits&lt;char> >::operator<<(class
> std::basic_ostream<char,struct std::char_traits&lt;char> > &
> (__cdecl*)(class std::basic_ostream<char,struct std::char_traits&lt;char> >
> &))"
> (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@
> Z) already defined in CGAL_Core-vc100-mt-gd-4.0.lib(all_files.obj)
>
> can anyone tell me the problem ?

My guess is that:
1/ you have not listen to us last month in the thread named "'CGAL-vc100-mt-
sgd.lib' and Win64-VC10", but you have managed to compile CGAL libraries
using
/MDd,
2/ you have renamed CGAL-vc100-mt-sgd.lib to CGAL-vc100-mt-gd.lib and
CGAL_Core-vc100-mt-sgd.lib to CGAL_Core-vc100-mt-gd.lib.
3/ then you have tried to compile the small example here, and that lead to
error LNK2005 because you mix static and dynamic C++ runtimes.

Am I wrong?

As I said before, if you compile CGAL libraries with /MD or /MDd, you will
not
get any support from the CGAL project, or from GeometryFactory people. Have
you compile CGAL libraries using the project generated by CMake, and not
forcing the /MD or /MDd flags? Have you generated static¹ CGAL libraries or
CGAL DLLs?


¹) Static libraries are not to be mixed up with libraries linked with the
static C and C++ runtimes.

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/




Archive powered by MHonArc 2.6.16.

Top of Page