title: C++ Linking Errors: Undefined symbols using a templated class
body: <p>I'm getting some really wierd linking errors from a class I wrote. I am completely unable to find anything that will describe what is happening. </p>
  
  <p>Visual Studio (Windows XP)</p>
  
  <blockquote>
    <p>players.obj : error LNK2019: unresolved external symbol "public: __thiscall TreeNode::TreeNode(void)" (??0?$TreeNode@VPlayer@@@@QAE@XZ) referenced in function "public: __thiscall PlayerList::PlayerList(void)" (??0PlayerList@@QAE@XZ)</p>
  </blockquote>
  
  <p>Xcode (OSX 10.5)</p>
  
  <blockquote>
    <p>Undefined symbols: "TreeNode::~TreeNode()", referenced from: PlayerList::~PlayerList()in players.o</p>
  </blockquote>
  
  <p>Header File: generics.h</p>
  
  <pre><code>class TreeNode : public BaseNode{
  public:
      const static int MAX_SIZE = -1; //-1 means any size allowed. 
      const static int MIN_SIZE = 0;
      //getters
      int size() const;
      vector&lt;C*&gt; getChildren() const;
      //setters
      void setChildren(vector&lt;C*&gt; &amp;list);
      //Serialization
      virtual void display(ostream &amp;out) const;
      virtual void read(istream &amp;in);
      virtual void write(ostream &amp;out) const;
      //Overrides so SC acts like an array of sorts. 
      virtual C* get(int id) const; 
      virtual int get(C *child) const;
      virtual bool has(C *child) const;
      virtual C* pop(int id);
      virtual void push(C *child);
      virtual TreeNode&amp; operator&lt;&lt; (C *child); //append
      virtual void remove(int id); //Clears memory 
      virtual void remove(C *child); //Clears memory 
      //Initalizers
      TreeNode();
      TreeNode(istream &amp;in);
      TreeNode(long id, istream &amp;in);
      TreeNode(BaseNode* parent, istream &amp;in);
      TreeNode(long id, BaseNode* parent);
      TreeNode(long id, BaseNode* parent, istream &amp;in);
      ~TreeNode();
      string __name__() const{ return "TreeNode"; }
  protected:
      void clearChildren();
      void initalizeChildren();
      vector&lt;C*&gt; _children;
  };
  </code></pre>
  
  <p>Code from a subclass of TreeNode</p>
  
  <pre><code>PlayerList::PlayerList() : TreeNode&lt;Player&gt;(){}
  PlayerList::PlayerList(istream &amp;in) : TreeNode&lt;Player&gt;(in){}
  PlayerList::~PlayerList(){}
  </code></pre>