title: error C2955: 'CELL' : use of class template requires template argument list C++ Stack
body: <p>I am creating a custom stack to use with a old class that used the stack library.</p>
  
  <p>Upon compiling I get the following error:</p>
  
  <p>error C2955: 'CELL' : use of class template requires template argument list C++ Stack</p>
  
  <p>It compiled with the .h file included up until I changed the stack (c++ library) to my_Stack (custom stack)</p>
  
  <p>The code for the h is as followed</p>
  
  <pre><code>#ifndef generic_stack_H
  #define generic_stack_H
  #include &lt;iostream&gt;
  using namespace std;
  
  /**************************************************************************
                          Structure CELL has two fields.
  ------------------     ------------------
  | element | next | -&gt;  | element | next |
  ------------------     ------------------
  **************************************************************************/
  template &lt;class T&gt;
  struct CELL { T element; struct CELL *next; };
  
  /**************************************************************************
                                  Class STACK.
  **************************************************************************/
  template &lt;class T&gt;
  class my_STACK
  {
  private:    CELL *topCellPtr;
  public:
      //----------------------------Constructor-----------------------------
      my_STACK()    {topCellPtr = NULL;}
      //--------------------------Member functions--------------------------
  void push(T e)
  {
      struct CELL *cP;
  
      cP = new CELL;
      cP-&gt;element = e;
      cP-&gt;next = NULL;
      if(topCellPtr != NULL)   
          cP-&gt;next = topCellPtr;
      topCellPtr = cP;
  
  }
  
  void pop()
  {
      struct CELL *cP;
  
      if(topCellPtr == NULL)
      {
          cout &lt;&lt; "Trying to pop an empty stack." &lt;&lt; endl;
          return;
      }
      cP = topCellPtr;
      topCellPtr = topCellPtr-&gt;next;       
  }
  
  bool empty() {
  
      bool check false;
  
      struct CELL *cP;
  
      if(topCellPtr == NULL)
      {
  
         check = true;
  
      }
  
     return true;
  
  }
  
  
  T top()    {return topCellPtr-&gt;element;}
  
  void print()
  {
      struct CELL *cP = topCellPtr;
  
      cout &lt;&lt; "Stack (top = left): ";
      while (cP != NULL)
      {
          cout &lt;&lt; cP-&gt;element &lt;&lt; " -&gt; ";
          cP = cP-&gt;next;
      }
      cout &lt;&lt; endl;       
  }   
  
  int Count_Occurences (int e) {
  
      int count = 0;
  
      struct CELL *cP = topCellPtr;
  
      while(cP != NULL) {
  
          if(cP-&gt;element == e) {
  
              count++;
  
          }//end if
  
          cP = cP-&gt;next;
  
      }//end while
  
      return count;
  
  }
  
  void Reverse_Stack() {
  
  struct CELL *nP = NULL;
  
  struct CELL *newtopCellPtr = nP;
  
  while(topCellPtr != NULL) {
  
      int n = this-&gt;top();
  
      this-&gt;pop();
  
      nP = new CELL;
      nP-&gt;element = n;
      nP-&gt;next = NULL;
  
      if(newtopCellPtr != NULL) {
  
          nP-&gt;next = newtopCellPtr;
  
      }
  
      newtopCellPtr = nP;
  
  }//end while
  
  topCellPtr = newtopCellPtr;
  
  }
  
  int nth(int index) {
  
      struct CELL *cP = topCellPtr;
  
      for(int i=1; i &lt; index; i++) {
  
          cP = cP-&gt;next;
  
      }//end for
  
      return cP-&gt;element;
  
  }
  
  void Append (my_STACK anotherStack) {
  
      anotherStack.Reverse_Stack();
  
      while(anotherStack.topCellPtr != NULL) {
  
          this-&gt;push(anotherStack.top());
  
          anotherStack.pop();
  
      }//
  
  end while
  
      }
  
  };
  
  #endif
  </code></pre>
  
  <p>My main function is as followed:</p>
  
  <pre><code>#include &lt;iostream&gt; /*input output stream...
                       print on screen... keyboard input*/
  
  //#include &lt;stack&gt;    //stack implementaiton
  
  #include &lt;ctype.h&gt;
  
  #include &lt;string&gt;
  
  #include "generic_stack.h"
  
  using namespace std;/*instead of specifically typing
                      std::cout we can simply write cout
                      this package also includes stack
                      container*/
  
  enum state {FRESH, ID, NUM, ICT, LESS, GREATER, LESSDASH, PLUS, MINUS, ERR};
  
  void reverse(my_STACK&lt;char&gt; &amp;s) {
  
      my_STACK&lt;char&gt; s2;
  
      while(!s.empty()) {
  
          s2.push(s.top());
  
          s.pop();
  
      }
  
      s = s2;
  
  }
  
  void Reverse_Stack_Stack(my_STACK&lt; my_STACK&lt;char&gt; &gt; &amp;s) {
  
      my_STACK&lt; my_STACK&lt;char&gt; &gt; s2;
  
      while(!s.empty()) {
  
          s2.push(s.top());
  
          s.pop();
  
      }
  
      s = s2;
  
  }
  
  
  void newLine(my_STACK&lt;char&gt; &amp;P , state &amp;current_state) {
  
      current_state = FRESH;
  
      while(!P.empty()) {
  
          P.pop();
  
      }
  
  }
  
  bool isToken(state s) {
  
      if(s == FRESH) {
  
          return false;
  
      } else if (s == ERR) {
  
          return false;
  
      } else {
  
          return true;
  
      }
  
  }
  
  bool canPush(char s , state current_state) {
  
      if(current_state == FRESH) {
  
          return true;
  
      } else
  
          if(current_state == NUM) {
  
              if(isdigit(s)) {
  
                  return true;
  
              } else { 
  
                  return false;
  
              }
  
      } else
  
          if(current_state == ID) {
  
              if(isalpha(s)) {
  
                  return true;
  
              } else {
  
                  return false;
  
              }
  
          } else
  
              if(current_state == LESSDASH) {
  
          if(s == '&gt;') {
  
              return true;
  
          } else {
  
              return false;
  
          }
  
      }/*end lessdash*/ else
  
      if(current_state == LESS) {
  
          if(s == '=' || s == '-' || s == '&gt;') {
  
              return true;
  
          } else { 
  
              return false;
  
          }
  
      }/*end less */ else
  
      if(current_state == GREATER) {
  
          if(s == '=') {
  
              return true;
  
          } else { 
  
              return false;
  
          }
  
      }/*end greater*/ else
  
      if(current_state == PLUS) {
  
          if(s == '+') {
  
              return true;
  
          } else {
  
              return false;
  
          }
  
      }/*end plus*/ else 
  
          if(current_state == MINUS) {
  
          if(s == '&gt;') {
  
              return true;
  
          } else {
  
              return false;
  
          }
  
  }/*end minus */ else {      
  
          return false;
  
          }
  
  }
  
  state nextState(state current_state, char c) {
  
          if(current_state == LESS &amp;&amp; c == '-') {
  
              return LESSDASH;
  
          } else 
  
              if(c == '&lt;') {
  
      return LESS;
  
      } else
  
      if(c == '&gt;') {
  
      return GREATER;
  
      } else
  
      if(c == '+') {
  
      return PLUS;
  
      } else
  
      if(c == '-') {
  
      return MINUS;
  
      } else
  
      if(isalpha(c) || c == '_') {
  
      return ID;
  
      } else
  
      if(isdigit(c)) {
  
      return NUM;
  
      } else
  
      if(c == '~' || c == '&amp;' || c == '^' || c == '*' || c == '(' || c == ')' || c == '[' || c == ']' || c == ':' || c == ',' || c == '=') {
  
          return ICT;
  
      }  else {
  
              return ERR;
  
          }
  
  }
  
  my_STACK&lt; my_STACK&lt;char&gt; &gt; maxMunch(my_STACK&lt;char&gt; S) {
  
      my_STACK&lt;char&gt; P;
  
      my_STACK&lt; my_STACK&lt;char&gt; &gt; T;
  
      state current_state = FRESH;
  
      while(!S.empty()) {
  
          while(S.top() == ' ' || S.top() == '\t' || S.top() == '\r' || S.top() == '\n') {
  
              S.pop();
  
              if(!P.empty()) {
  
                  T.push(P);
  
                  while(!P.empty()) {
  
                      P.pop();
  
                  }
  
              }
  
              current_state = FRESH;
  
          }//end second loop
  
          if(canPush(S.top() , current_state)) {
  
              P.push(S.top());
  
              current_state = nextState(current_state, S.top());
  
              S.pop();
  
          } else {
  
              if(isToken(current_state)/*P is a valid token*/) {
  
                   T.push(P);
  
                   newLine(P , current_state);
  
               } else {
  
                  cout &lt;&lt; "Tokenizing Error";
  
                   newLine(P , current_state);
  
               }//end else
  
          }
  
      }//end loop
  
  
      T.push(P);
  
  
       if(S.empty()) {
  
              return T;//returns the tokens
  
          }
  
  }
  
  /**************************************************************************
  Takes a string s and a stack theStack by refernce. Breaks the stirng s into
  char data types and pushes them into the stack theStack.
  ***************************************************************************/
  void Break_Up_Into_Stack(string s, my_STACK&lt;char&gt; &amp;theStack)
  {
      while (!theStack.empty())   {theStack.pop();} // empty the stack before use.
  
      for ( int pos = s.length() - 1; pos &gt;= 0; pos--)
          theStack.push(s.at(pos));
  
  }
  
  /**************************************************************************
  Takes a stack of chars s by value. Prints the stack on screen.
  ***************************************************************************/
  void Print_Stack_Of_Char (my_STACK&lt;char&gt; s)
  {
      cout &lt;&lt; "-----top of stack: -----" &lt;&lt; endl;
      while (!s.empty())  {cout &lt;&lt; s.top(); s.pop();}
      cout &lt;&lt; endl;
      cout &lt;&lt; "---Bottom of stack: ----" &lt;&lt; endl &lt;&lt; endl;
  }
  
  void printMunch (my_STACK&lt; my_STACK&lt;char&gt;&gt; s)
  {
  
      while (!s.empty())  {
  
         Print_Stack_Of_Char (s.top());
  
          cout &lt;&lt; "" &lt;&lt; endl; 
  
          s.pop();
  
      }
  
  }
  
  void Print_Tokens (my_STACK&lt;my_STACK&lt;char&gt; &gt; s)
  {
      int count = 1;
      Reverse_Stack_Stack(s);
      while (s.empty() == false)
  {
      cout &lt;&lt; count &lt;&lt; ". ";
      reverse (s.top());
      while (s.top().empty() == false)
      {
      cout &lt;&lt; s.top().top();
      s.top().pop();
      }
      cout &lt;&lt; endl;
      count++;
      s.pop();
      }
  }
  
  int main() //main function
  {
  //state A = GREATER;
   //char c = '-';
   //cout &lt;&lt; canPush(c, A) &lt;&lt; endl;
          string inputString;
      my_STACK&lt;char&gt; charStack;
  
      cout &lt;&lt; "Enter the string: ";
      getline(cin, inputString);
  
      string testString1 = "83 - 8 * [aVar - (2 + 1)] / aVar2";
      string testString2 = "amountOfWork &lt;= 1";
  
      Break_Up_Into_Stack(inputString, charStack);
  
      //Print_Stack_Of_Char(charStack);
  
      //reverse(charStack);
  
      my_STACK &lt;my_STACK&lt;char&gt; &gt; Final;
  
      Final = maxMunch(charStack);
  
      Print_Tokens(Final);
  
      //printMunch(Final);
      char inp;
      cin&gt;&gt;inp;
  
  }
  </code></pre>
  
  <p>I have no idea what the error could be, I have tried numerous things and it doesn't work. the program worked with the original stack but I need to implement the custom stack.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here is what the compiler outputs:</p>
  
  <pre><code>1&gt;------ Build started: Project: project_7, Configuration: Debug Win32 ------
  1&gt;  main.cpp
  1&gt;c:\users\administrator\documents\visual studio 2010\projects\project_7\project_7\generic_stack.h(29): error C2143: syntax error : missing ';' before 'template'
  1&gt;c:\users\administrator\documents\visual studio 2010\projects\project_7\project_7\main.cpp(23): error C2039: 'empty' : is not a member of 'my_STACK&lt;T&gt;'
  1&gt;          with
  1&gt;          [
  1&gt;              T=char
  1&gt;          ]
  1&gt;c:\users\administrator\documents\visual studio 2010\projects\project_7\project_7\main.cpp(23): fatal error C1903: unable to recover from previous error(s); stopping compilation
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>