I recently converted my linked list code from C to C++ using templates. Afaik, my functions are clearly defined, but my compiler (XCode) still doesn't like it. Here's an example function definition:
template <class T>
class node_t
{
node_t();
virtual ~node_t();
public:
T data;
node_t<T>* next;
};
template <class T>
void list_add_end( node_t<T>** list, T data );
And this is a usage example:
class base_process_t
{
base_process_t();
virtual ~base_process_t();
public:
virtual void foo1() PURE;
virtual void foo2() PURE;
};
list_add_end<base_process_t*>( &process_list, new base_process_t() );
This all compiles fine, but doesn't link. The typical error I get is:
Undefined symbols
"list_add_end<base_process_t*>( node_t<base_process_t*>**, base_process_t* )" referenced from (blah blah blah)
This isn't really making any sense to me. Is it because of my classes using virtual functions by chance? This is my first time attempting to do this, and after all the years I've been using C++, I can't believe I'm stumped on a seemingly minuscule problem, and I have the feeling I'm going to feel really stupid once I figure this out. This sucks. Any ideas? Thanks.
Shogun