   Passing an ADT list to a function...[SOLVED]
  hi,I´m having problems to implement a function that receives an abstract data type list. I´ve already trying to solve it for more than a week... :´(the linker gives me the following error:[Linker error] undefined reference to `int pick<Shape*>(std::list<Shape*, std::allocator<Shape*> >&, int, int, unsigned int)'where pick() is a function that receives an ADT list of figures and returns the ID of the selected figure.Here goes the main code snippets:---------- libpick.h ---------------    // It must be defined using templates because i dont know    // which type of figure the user will pass( cilinder, cube, etc )    template < class T >    int pick( std::list< T > &shapeList, int mouse_x, int    mouse_y, unsigned int buf_size );---------------------------------------------- libpick.cpp ------------------    template < class T >    int pick( std::list< T > &shapeList, int mouse_x, int    mouse_y, unsigned int buf_size )    {    typename std::list< T >::iterator i;  .  .  .    }------------------------------------------------------------- canvas.h -------------------------------------    // Canvas class. Here are instantiated the figures// to be drawn and to be selected by pick();    // A polimorfic list of Shape, the base class to other figure classes.    std::list< Shape * > objList;    std::list< Shape * >::iterator iter;    class Canvas: public wxGLCanvas    { public:    .    .    .  void OnMouse( wxMouseEvent& );    .    .    .  private:  // Just to ilustrate. Two pointer to Shape. In the .cpp I call the // correct constructor, e.g., c1 = new Cube;   Shape *c1;  Shape *c2;    }------------------------------------------------------------- canvas.cpp ---------------------------void Canvas::OnMouse( wxMouseEvent &event ){    int id = pick( objList, event.GetX(), event.GetY(), 512);...}-------------------------------------------------the prototype of pick() is like:   int pick( std::list < Shape * >, int, int, unsigned int);but the linker tries to link with this:int pick<Shape *>( std:: list < Shape * >, int, int, unsigned int );Why the linker puts < Shape * > in the prototype??Is it wrong to call the pick() in a member function?Thanks in advance.[Edited by - Himura-San on June 5, 2006 4:44:42 PM]
  You're getting a linker error because your pick implementation is in a .cpp file.  Move it to the header and then search the forums to see the myriad of posts on the same subject.   ;Why templates are not like normal functions.Σnigma   ;  Thanks. Its working now :D