Hi, I'm trying to get CGAL working with VS 2005. So, I installed the Boost libraries as well as CGAL and tried to run the following example program:

``````// file: examples/Polygon/Example.C

//-----------------------------------------------------------------------//
// This is just a simple example that demonstrates how to use the
// class CGAL::Polygon_2.
//-----------------------------------------------------------------------//

#include <CGAL/Cartesian.h>
#include <CGAL/Polygon_2.h>

#include <list>

typedef CGAL::Cartesian<double> K;
typedef CGAL::Point_2<K> Point;
typedef CGAL::Polygon_2<K, std::list<Point> > Polygon;
typedef CGAL::Polygon_2<K, std::list<Point> >::Vertex_iterator VertexIterator;
typedef CGAL::Polygon_2<K, std::list<Point> >::Edge_const_iterator EdgeIterator;

//-----------------------------------------------------------------------//
//                          main
//-----------------------------------------------------------------------//

int main()
{
// create a polygon and put some points in it
Polygon p;
p.push_back(Point(0,0));
p.push_back(Point(4,0));
p.push_back(Point(4,4));
p.push_back(Point(2,2));
p.push_back(Point(0,4));

CGAL::set_pretty_mode(std::cout);
std::cout << "created the polygon p:" << std::endl;
std::cout << p << std::endl;
std::cout << std::endl;

// determine some properties of the polygon
bool IsSimple    = p.is_simple();
bool IsConvex    = p.is_convex();
bool IsClockwise = (p.orientation() == CGAL::CLOCKWISE);
double Area      = p.area();

std::cout << "polygon p is";
if (!IsSimple) std::cout << " not";
std::cout << " simple." << std::endl;

std::cout << "polygon p is";
if (!IsConvex) std::cout << " not";
std::cout << " convex." << std::endl;

std::cout << "polygon p is";
if (!IsClockwise) std::cout << " not";
std::cout << " clockwise oriented." << std::endl;

std::cout << "the area of polygon p is " << Area << std::endl;
std::cout << std::endl;

// apply some algorithms
Point q(1,1);
std::cout << "created point q = " << q << std::endl;
std::cout << std::endl;

bool IsInside = (p.bounded_side(q) == CGAL::ON_BOUNDED_SIDE);
std::cout << "point q is";
if (!IsInside) std::cout << " not";
std::cout << " inside polygon p." << std::endl;
std::cout << std::endl;

// traverse the vertices and the edges
int n=0;
for (VertexIterator vi = p.vertices_begin(); vi != p.vertices_end(); ++vi)
std::cout << "vertex " << n++ << " = " << *vi << std::endl;
std::cout << std::endl;

n=0;
for (EdgeIterator ei = p.edges_begin(); ei != p.edges_end(); ++ei)
std::cout << "edge " << n++ << " = " << *ei << std::endl;

return 0;
}``````

Then I tried to build my project and I get the followin errors:

``````1>------ Build started: Project: Example, Configuration: Debug Win32 ------
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??\$?6U?\$char_traits@D@std@@@std@@YAAAV?\$basic_ostream@DU?\$char_traits@D@std@@@0@AAV10@PBD@Z) already defined in Example.obj
1>Example.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: class CGAL::Point_2<struct CGAL::Cartesian<double> > const & __thiscall std::list<class CGAL::Point_2<struct CGAL::Cartesian<double> >,class std::allocator<class CGAL::Point_2<struct CGAL::Cartesian<double> > > >::_Const_iterator<1>::operator*(void)const " (??D?\$_Const_iterator@\$00@?\$list@V?\$Point_2@U?\$Cartesian@N@CGAL@@@CGAL@@V?\$allocator@V?\$Point_2@U?\$Cartesian@N@CGAL@@@CGAL@@@std@@@std@@QBEABV?\$Point_2@U?\$Cartesian@N@CGAL@@@CGAL@@XZ)
1>Debug/Example.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\stagiaire\Mes documents\Visual Studio 2005\Projects\Debug\BuildLog.htm"
1>Example - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========``````

Can anyone please explain how to solve this problem.. Thanks ...

2
Contributors
1