title: c++ error: expected type-specifier
body: <p>When I attempt to compile this simple linked list testing program using the command </p>
  
  <pre><code>g++ -o SLLtest SLLtester.cpp intSLList.o
  </code></pre>
  
  <p>I receive the error: </p>
  
  <pre><code>SLLtester.cpp: In function ‘int main()’:
  SLLtester.cpp:4:27: error: expected type-specifier
  SLLtester.cpp:4:27: error: cannot convert ‘int*’ to ‘intSLList*’ in initialization
  SLLtester.cpp:4:27: error: expected ‘,’ or ‘;’
  </code></pre>
  
  <p>I am missing something simple but I am not sure what. The header and the definitions of the linked list compile without a problem. The three files are included.</p>
  
  <pre><code>//intSLList.hh
  #ifndef INT_LINKED_LIST
  #define INT_LINKED_LIST
  
  class intSLList {
  public:
   intSLList(){head=tail=0;}
   void Print();
   void AddToHead(int);
   void AddToTail(int);
   int RemoveFromHead();
   int RemoveFromTail();
  
  protected:
   struct Node {
    int info;
    Node *next;
    Node(int e1, Node *ptr = 0) {info = e1; next = ptr;}
   } *head, *tail, *tmp;
   int e1;
  };
  
  #endif
  </code></pre>
  
  <p>And the definitions:</p>
  
  <pre><code>//intSLList.cpp
  #include "intSLList.hh"
  #include &lt;iostream&gt;
  
  void intSLList::AddToHead(int e1){
   head = new Node(e1,head);
   if (!tail)
    tail = head;
  }
  
  void intSLList::AddToTail(int e1){
   if (tail) {
    tail-&gt;next = new Node(e1);
    tail = tail-&gt;next;
   }
   else 
    head = tail = new Node(e1);
  }
  
  int intSLList::RemoveFromHead(){
   if (head){
    e1 = head-&gt;info;
    tmp = head;
    if (head == tail)
     head = tail = 0;
    else 
     head = head-&gt;next;
   delete tmp;
   return e1;
   }
   else
    return 0;    
  }
  
  int intSLList::RemoveFromTail(){
   if (tail){
    e1 = tail-&gt;info;
    if (head == tail){
     delete head;
     head = tail = 0;
    }
    else {
     for ( tmp = head; tmp-&gt;next != tail; tmp = tmp-&gt;next);
     delete tail;
     tail = tmp;
     tail-&gt;next = 0;
    } 
    return e1;
   }
   else return 0;
  }
  
  void intSLList::Print(){
   tmp = head;
   while( tmp != tail ){
    std::cout &lt;&lt; tmp-&gt;info &lt;&lt; std::endl;
    tmp = tmp-&gt;next;
   }
  }
  </code></pre>
  
  <p>And finally the main function:</p>
  
  <pre><code>#include "intSLList.hh"
  
  int main(){
   intSLList* mylist = new intSLList::intSLList();
   for ( int i = 0; i &lt; 10; i++ ){   
    mylist-&gt;AddToTail(i);    
   }
   mylist-&gt;Print();
  }
  </code></pre>
  
  <p>Thank you for the help.</p>