title: error LNK2019: unresolved external symbol "public: void __thiscall
body: <p>My assignment is to write code to keep track of a sorted linked list using recursion. We were given the make up of the classes and files, but needed to fill out the functions. I'm getting four errors that I believe to be caused by calling the private functions in the public functions. My errors are:</p>
  
  <pre><code>1&gt;SortedList.obj : error LNK2019: unresolved external symbol "public: void __thiscall SortedList::recursiveMakeEmpty(class NodeType * &amp;)" (?recursiveMakeEmpty@SortedList@@QAEXAAPAVNodeType@@@Z) referenced in function "public: void __thiscall SortedList::makeEmpty(void)" (?makeEmpty@SortedList@@QAEXXZ)
  1&gt;SortedList.obj : error LNK2019: unresolved external symbol "public: bool __thiscall SortedList::recursiveInsert(class NodeType * &amp;,int)" (?recursiveInsert@SortedList@@QAE_NAAPAVNodeType@@H@Z) referenced in function "public: bool __thiscall SortedList::insert(int)" (?insert@SortedList@@QAE_NH@Z)
  1&gt;SortedList.obj : error LNK2019: unresolved external symbol "public: bool __thiscall SortedList::recursiveDelete(class NodeType * &amp;,int)" (?recursiveDelete@SortedList@@QAE_NAAPAVNodeType@@H@Z) referenced in function "public: bool __thiscall SortedList::deleteItem(int)" (?deleteItem@SortedList@@QAE_NH@Z)
  1&gt;SortedList.obj : error LNK2019: unresolved external symbol "public: void __thiscall SortedList::recursivePrint(class NodeType * &amp;)" (?recursivePrint@SortedList@@QAEXAAPAVNodeType@@@Z) referenced in function "public: void __thiscall SortedList::printList(void)" (?printList@SortedList@@QAEXXZ)
  1&gt;C:\Users\Ross\documents\visual studio 2010\Projects\Recursive Sorted List\Debug\Recursive Sorted List.exe : fatal error LNK1120: 4 unresolved externals
  </code></pre>
  
  <p>My code:</p>
  
  <p>Node.h</p>
  
  <pre><code>typedef int ItemType;
  
  class NodeType
      {
      public:
          ItemType info;
          NodeType *next;
      };
  </code></pre>
  
  <p>SortedList.h</p>
  
  <pre><code>#include "MyClass.h"
  
  string MyClass::foo = "bar"          #pragma once
  
        #include &lt;iostream&gt;
        #include "Node.h"
  
        using namespace std;
  
        class SortedList 
        {
        public:
          SortedList();
          // Constructor used before any operations are done on the list.  Initializes the list to empty.
          // Preconditions: None.
          // Postconditions: List is an empty list.
  
          ~SortedList();
          // Destructor used when a List is no longer in scope.
          // Precondition: None.
          // Postcondition: No dynamic variables exist.
  
          void makeEmpty();
          // Makes the list empty if it is not empty already.
          // Preconditions: The list may be empty or have items in it.
          // Postconditions: List is now an empty list.  Any dynamically allocated memory which is no longer used is returned to the system. 
    The current position is 1.
          // Note: This function body is different from the constructor.
  
          bool isEmpty();
          // Returns True if List is an empty list; return False otherwise.
          // Postconditions: List remains unchanged.
  
          bool isFull();
          // Returns True if List is full; returns False other wise.
          // Postcondition: List remains unchanged.
          // Note: For linked list implementation, you can simply return false.
  
          bool insert( ItemType newItem );
          // Inserts the given newItem in the list maintaining sorted order.
          // Preconditions: The list may be empty.
          // Postconditions: If the list already contained a matching item, the function returned false and the list is unchanged.
          // Otherwise the newItem is inserted in the linked list so that the list maintains sorted order, and true is returned.
  
          bool deleteItem( ItemType deleteItem );
          // Deletes the item from the linked list if it is found.
          // Preconditions: List may be empty.  At most one matching item is in the list.
          // Postconditions: If the itemwas in the list, it is deleted and true is returned.  If the item was not in the list, the list is
    unchanged and false is returned.
  
          void printList();
          // Prints items in the list
          // Preconditions: Assumes that the operator &lt;&lt; has been defined for ItemType.
          // Postcondition: Items on the list have been printed to the standard output.  List is unchanged.
  
        private:
          NodeType *head;
          // Points to head of linked list.
  
          void recursiveMakeEmpty( NodeType *&amp; node);
          // Makes the list empty if it is not empty already.
          // Preconditions: The list may be empty or have items in it.
          // Postconditions: List is now an empty list.  Any dynamically allocated memory which is no longer used is returned to the system. 
    The current position is 1.
  
          bool recursiveInsert( NodeType *&amp; node, ItemType newItem );
          // Inserts the given newItem in the list maintaining sorted order.
          // Preconditions: The list may be empty.
          // Postconditions: If the list already contained a matching item, the function returned false and the list is unchanged.
          // Otherwise the newItem is inserted in the linked list so that the list maintains sorted order, and true is returned.
  
          bool recursiveDelete( NodeType *&amp; node, ItemType deleteItem );
          // Deletes the item from the linked list if it is found.
          // Preconditions: List may be empty.  At most one matching item is in the list.
          // Postconditions: If the itemwas in the list, it is deleted and true is returned.  If the item was not in the list, the list is
    unchanged and false is returned.
  
          void recursivePrint( NodeType *&amp; node );
          // Prints items in the list
          // Preconditions: Assumes that the operator &lt;&lt; has been defined for ItemType.
          // Postcondition: Items on the list have been printed to the standard output.  List is unchanged.
        };
  </code></pre>
  
  <p>SortedList.cpp</p>
  
  <pre><code>#include "SortedList.h"
  
  SortedList::SortedList()
  // Constructor used before any operations are done on the list.  Initializes the list to empty.
  // Preconditions: None.
  // Postconditions: List is an empty list.
  {
      head = NULL;
  }
  
  SortedList::~SortedList()
  // Destructor used when a List is no longer in scope.
  // Precondition: None.
  // Postcondition: No dynamic variables exist.
  {
      makeEmpty();
  }
  
  void SortedList::makeEmpty()
  // Makes the list empty if it is not empty already.
  // Preconditions: The list may be empty or have items in it.
  // Postconditions: List is now an empty list.  Any dynamically allocated memory which is no longer used is returned to the system.  The current position is 1.
  // Note: This function body is different from the constructor.
  {
      recursiveMakeEmpty(head);
  }
  
  
  bool SortedList::isEmpty()
  // Returns True if List is an empty list; return False otherwise.
  // Postconditions: List remains unchanged.
  {
      return ( head == NULL );
  }
  //
  bool SortedList::isFull()
  // Returns True if List is full; returns False other wise.
  // Postcondition: List remains unchanged.
  // Note: For linked list implementation, you can simply return false.
  {
      return false;
  }
  
  bool SortedList::insert( ItemType newItem )
  // Inserts the given newItem in the list maintaining sorted order.
  // Preconditions: The list may be empty.
  // Postconditions: If the list already contained a matching item, the function returned false and the list is unchanged.
  // Otherwise the newItem is inserted in the linked list so that the list maintains sorted order, and true is returned.
  {
      return recursiveInsert( head, newItem );
  }
  
  bool SortedList::deleteItem( ItemType deleteItem )
  // Deletes the item from the linked list if it is found.
  // Preconditions: List may be empty.  At most one matching item is in the list.
  // Postconditions: If the itemwas in the list, it is deleted and true is returned.  If the item was not in the list, the list is unchanged and false is returned.
  {
      return recursiveDelete( head, deleteItem );
  }
  
  void SortedList::printList()
  // Prints items in the list
  // Preconditions: Assumes that the operator &lt;&lt; has been defined for ItemType.
  // Postcondition: Items on the list have been printed to the standard output.  List is unchanged.
  {
      recursivePrint( head );
  }
  
  bool recursiveInsert( NodeType *&amp; node, ItemType newItem )
  // Inserts the given newItem in the list maintaining sorted order.
  // Preconditions: The list may be empty.
  // Postconditions: If the list already contained a matching item, the function returned false and the list is unchanged.
  // Otherwise the newItem is inserted in the linked list so that the list maintains sorted order, and true is returned.
  {
      if( node == NULL )
      {
          node = new NodeType;
          node-&gt;info = newItem;
          node-&gt;next = NULL;
          return true;
      }
      else if( node-&gt;info == newItem )
      {
          return false;
      }
      else if( newItem &lt; node-&gt;next-&gt;info )
      {
          NodeType* ptr = new NodeType;
          ptr-&gt;info = newItem;
          ptr-&gt;next = node-&gt;next;
          node-&gt;next = ptr;
          return true;
      }
      else
      {
          recursiveInsert( node-&gt;next, newItem );
      }
  }
  
  bool recursiveDelete( NodeType *&amp; node, ItemType deleteItem )
      // Deletes the item from the linked list if it is found.
      // Preconditions: List may be empty.  At most one matching item is in the list.
      // Postconditions: If the itemwas in the list, it is deleted and true is returned.  If the item was not in the list, the list is unchanged and false is returned.
  {
      if( node == NULL )
      {
          return false;
      }
      else if( node-&gt;next-&gt;info == deleteItem )
      {
          NodeType* ptr = node-&gt;next-&gt;next;
          delete node-&gt;next;
          node-&gt;next = ptr;
          return true;
      }
      else
      {
          recursiveDelete( node-&gt;next, deleteItem );
      }
  }
  
  void recursiveMakeEmpty( NodeType *&amp; node)
  // Makes the list empty if it is not empty already.
  // Preconditions: The list may be empty or have items in it.
  // Postconditions: List is now an empty list.  Any dynamically allocated memory which is no longer used is returned to the system.  The current position is 1.
  {
      if( node == NULL )
      {
          return;
      }
      else
      {
          recursiveDelete( node, node-&gt;info );
      }
  }
  
  void recursivePrint( NodeType *&amp; node )
  // Prints items in the list
  // Preconditions: Assumes that the operator &lt;&lt; has been defined for ItemType.
  // Postcondition: Items on the list have been printed to the standard output.  List is unchanged.
  {
      if( node == NULL )
      {
          return;
      }
      else if( node-&gt;next == NULL )
      {
          cout &lt;&lt; node-&gt;info &lt;&lt; "\n\n";
      }
      else
      {
          cout &lt;&lt; node-&gt;info &lt;&lt; ", ";
          recursivePrint(node-&gt;next);
      }
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "SortedList.h"
  
  void menuSelection(char &amp;selection);
  
  int main()
  {
      char selection = 'S';
      SortedList List;
      ItemType item;
  
      do
      {
          menuSelection(selection);
  
          switch( selection )
          {
          case 'A':
              cout &lt;&lt; "What item would you like to add?   ";
              cin &gt;&gt; item;
              if (List.insert(item))
              {
                  cout &lt;&lt; "\n Item has been added! \n\n";
              }
              else
              {
                  cout &lt;&lt; "\n Item already in list! \n\n";
              }
              break;
          case 'D':
              cout &lt;&lt; "What item would you like to delete?    ";
              cin &gt;&gt; item;
              if (List.deleteItem(item))
              {
                  cout &lt;&lt; "\n Item has been deleted! \n\n";
              }
              else
              {
                  cout &lt;&lt; "\n Item was not found! \n\n";
              }
              break;
          case 'M':
              List.makeEmpty();
              cout &lt;&lt; "\n List is now empty! \n\n";
              break;
          case 'P':
              cout &lt;&lt; "\n The list is:  ";
              List.printList();
              cout &lt;&lt; "\n\n";
              break;
          }
      } while( selection != 'Q' );
  
  
      return 0;
  }
  
  void menuSelection(char &amp;selection)
  {
      cout &lt;&lt; "What would you like to do? \n\n";
      cout &lt;&lt; "A - add item. \n";
      cout &lt;&lt; "D - delete item. \n";
      cout &lt;&lt; "M - make empty. \n";
      cout &lt;&lt; "P - print list. \n";
      cout &lt;&lt; "Q - quit. \n\n";
      do
      {
          cin &gt;&gt; selection;
          if( selection != 'A' &amp;&amp; selection != 'D' &amp;&amp; selection != 'M' &amp;&amp; selection != 'P' &amp;&amp; selection != 'Q' )
          {
              cout &lt;&lt; "Must enter A, D, M, P, or Q.";
          }
      } while( selection != 'A' &amp;&amp; selection != 'D' &amp;&amp; selection != 'M' &amp;&amp; selection != 'P' &amp;&amp; selection != 'Q' );
  }
  </code></pre>