title: Adding object to Linked List error [C++]
body: <p>I am attempting to add an object to a Linked List structure but keep receiving this error in Visual Studio 2015:</p>
  
  <pre><code>Error   LNK2019 unresolved external symbol "public: void __thiscall Stack::add(class Creature *)" (?add@Stack@@QAEXPAVCreature@@@Z) referenced in function _main    
  </code></pre>
  
  <p>Here is my code to add to the list - this functions fine if I modify it to simply add an integer value to a linked list(not allowed to use the STL):</p>
  
  <pre><code>#include "Creature.h"
  
  void Stack::add(Creature* obj) {
      /* create head node if list is empty */
      if (head == NULL) {
          head = new Node;
          head-&gt;data = obj;
          head-&gt;next = NULL;
      }
      else {
          /* set pointer to head */
          Node* temp = head;
  
          /* iterate until next node is empty */
          while (temp-&gt;next != NULL)
              temp = temp-&gt;next;
  
          /* create new node when NULL */
          temp-&gt;next = new Node;
          temp-&gt;next-&gt;data = obj;
          temp-&gt;next-&gt;next = NULL;
      }
  }
  </code></pre>
  
  <p>Here is my Creature class definition (abstract class):</p>
  
  <pre><code>class Creature {
      protected:
          int strike, defense,
              armor, strength,
              damage;
          bool alive;
          string type;
      public:
          Creature(
                  strike = 0;
                  defense = 0;
                  armor = 0;
                  strength = 0;
                  alive = true;
                  type = " ";
                  );
          virtual int attack() = 0;
          virtual bool defend(int) = 0;
          virtual string name() = 0;
  };
  </code></pre>
  
  <p>And here is my main function where I attempt to add the object to the list:</p>
  
  <pre><code>#include "Stack.h"
  #include "Creature.h"
  #include "Barbarian.h"
  
  int main() {
      Stack q;
      Creature *test = new Barbarian;
      q.add(test);
      return 0;
  }
  </code></pre>
  
  <p>I am still pretty fresh to C++ so I am trying to learn everything that I can and attempt to figure things out on my own first before asking for help, but I just cannot see what I may be missing here. Any help/resources would be greatly appreciated!</p>