C++ compiler error on BloodShed DevC++
<p>I am trying to figure out exactly what I did wrong to gain the below compiler error, I am using Bloodshed Dev-C++ 4.9.9.2:</p>

<p>Errors read:
prototype for 'stackType::stackType(const stackType&amp;)' does not match any in class 'stackType' and template definition of non-template 'stackType::stackType(const stackType&amp;)' for the one definition of my copy constructor</p>

<pre><code>stackType&lt;Type&gt;::stackType(const stackType&lt;Type&gt;&amp; otherStack) //definition of copy constructor
{
     list = NULL;
     copyStack(otherStack);
}
</code></pre>

<p>another error is stackType::stackType(int) but it doesn't say anything further the code is for the definition of the constructor this error is:</p>

<pre><code>template &lt;class Type&gt;
stackType&lt;Type&gt;::stackType(int stackSize) //definition of constructor
{
     if (stackSize &lt;= 0)
     {
          cout &lt;&lt; "Size of the array holding the stack must be positive." &lt;&lt; endl;
          cout &lt;&lt; "Creating an array of size 100." &lt;&lt; endl;
          maxStackSize = 100;
     }
     else
          maxStackSize = stackSize; //sets stack size to value specified by parameter stackSize
          stackTop = 0; //sets stackTop to 0
          list = new Type[maxStackSize]; //creates array to hold elements of the stack
}
</code></pre>

<p>my final error that I am getting states In file included from C:\Users\Owner\Desktop\SD254\SD254 Unit7B.cpp and again does not say further. The above is obviously the directory for where the main file is stored on my computer but why is that an issue?? my full code is below.</p>

<p>header file:</p>

<pre><code>#ifndef H_StackType
#define H_StackType
#include &lt;iostream&gt;
#include &lt;cassert&gt;


using namespace std;

template &lt;class Type&gt;
class stackADT
{
      public:
             virtual void initializeStack() = 0; //initialize stack
             virtual bool isEmptyStack() const = 0; //determines whether stack is empty or not
             virtual bool isFullStack() const = 0; //determines whether stack is full or not
             virtual void push(const Type&amp; newItem) = 0; //adds new item to the stack
             virtual Type top() const = 0; //returns the top element to the stack
             virtual void pop() = 0; //removes the top element of the stack
};
template &lt;class Type&gt;
class stackType: public stackADT&lt;Type&gt;
{
      public:
             const stackType&lt;Type&gt;&amp; operator=(const stackType&lt;Type&gt;&amp;); //overloads assignment operator
             void initializeStack(); //initializes stack to empty state
             bool isEmptyStack() const; //determines stack is empty
             bool isFullStack() const; //determines stack is not full
             void push(const Type&amp; newItem); //adds new item to stack
             Type top() const; //return the top element of the stack
             void pop(); //removes top element of the stack
             stackType(int stackSize = 100); //constructor and creates array with default size of 100
             ~stackType(); //destructor and removes all elements from the stack
             void copyStack(const stackType&lt;Type&gt;&amp; otherStack); //copies other stack
      private:
              int maxStackSize; //stores maximum stack size
              int stackTop; //point to the top of the stack
              Type *list; //pointer to the array that holds the stack elements

};
template &lt;class Type&gt;
void stackType&lt;Type&gt;::initializeStack() //definition of function intializeStack
{
     stackTop = 0;
}
template &lt;class Type&gt;
bool stackType&lt;Type&gt;::isEmptyStack() const //definition of function isEmptyStack
{
     return(stackTop == 0);
}
template &lt;class Type&gt;
bool stackType&lt;Type&gt;::isFullStack() const //definition of function isFullStack
{
      return (stackTop == maxStackSize);
}
template &lt;class Type&gt;
void stackType&lt;Type&gt;::push(const Type&amp; newItem) //definition of push function
{
     if (!isFullStack())
     {
          list[stackTop] = newItem; //adds new item to top of stack
          stackTop++; //increments stackTop
     }
     else
          cout &lt;&lt; "Cannot add to a full stack." &lt;&lt; endl;
}
template &lt;class Type&gt;
Type stackType&lt;Type&gt;::top() const //definition of top-returns the top element to the stack
{
     assert(stackTop != 0); //if stack is empty terminate program
     return list[stackTop - 1]; //return element of the stack indicated by stackTop -1
}
template &lt;class Type&gt;
void stackType&lt;Type&gt;::pop() //definition of function pop
{
     if (!isEmptyStack())
          stackTop--; //decrement stackTop
     else
          cout &lt;&lt; "Cannot remove from an empty stack." &lt;&lt; endl;
}
template &lt;class Type&gt;
void stackType&lt;Type&gt;::copyStack(const stackType&lt;Type&gt;&amp; otherStack) //definition to make copy of stack
{
     delete [] list;
     maxStackSize = otherStack.maxStackSize;
     stackTop = otherStack.stackTop;
     list = new Type[maxStackSize]; //copies otherStack into this one
     for (int j = 0; j &lt; stackTop; j++)
          list[j] = otherStack.list[j];
}
template &lt;class Type&gt;
stackType&lt;Type&gt;::stackType(int stackSize) //definition of constructor
{
     if (stackSize &lt;= 0)
     {
          cout &lt;&lt; "Size of the array holding the stack must be positive." &lt;&lt; endl;
          cout &lt;&lt; "Creating an array of size 100." &lt;&lt; endl;
          maxStackSize = 100;
     }
     else
          maxStackSize = stackSize; //sets stack size to value specified by parameter stackSize
          stackTop = 0; //sets stackTop to 0
          list = new Type[maxStackSize]; //creates array to hold elements of the stack
 }
template &lt;class Type&gt;
stackType&lt;Type&gt;::~stackType() //definition of destructor
{
     delete [] list; //deallocates the memory occupied by the array
}
template &lt;class Type&gt;
stackType&lt;Type&gt;::stackType(const stackType&lt;Type&gt;&amp; otherStack) //definition of copy constructor
{
     list = NULL;
     copyStack(otherStack);
}
template &lt;class Type&gt;
const stackType&lt;Type&gt;&amp; stackType&lt;Type&gt;::operator=(const stackType&lt;Type&gt;&amp; otherStack) //overload assignment operator
{
      if (this != &amp;otherStack) 
           copyStack(otherStack);
      return *this;
}
#endif
</code></pre>

<p>the actual program file is:</p>

<pre><code>#include &lt;iostream&gt;
#include "myStack.h"

using namespace std;
void testCopyConstructor(stackType&lt;int&gt; otherStack);
int main()
{
    stackType&lt;int&gt; stack(25);
    stackType&lt;int&gt; copyStack(25);
    stackType&lt;int&gt; dummyStack(50);

    stack.initializeStack();
    stack.push(15);
    stack.push(10);
    stack.push(20);
    copyStack = stack; //copies stack into copyStack

    cout &lt;&lt; "The elements of copyStack: " ;
    while (!copyStack.isEmptyStack()) //prints copyStack
    {
          cout &lt;&lt; copyStack.top() &lt;&lt; " ";
          copyStack.pop();
    }
    cout &lt;&lt; endl;
    copyStack = stack;
    testCopyConstructor(stack); //tests the copy constructor
    if (!stack.isEmptyStack())
         cout &lt;&lt; "The original stack is not empty." &lt;&lt; endl; 
         cout &lt;&lt; "The top element of the original stack: " &lt;&lt; copyStack.top() &lt;&lt; endl;
    dummyStack = stack; //copies stack into dummyStack
    cout &lt;&lt; "The elements of dummyStack: ";
    while (!dummyStack.isEmptyStack()) //prints dummyStack
    {
          cout &lt;&lt; dummyStack.top() &lt;&lt; " " ;
          dummyStack.pop();
    }
    cout &lt;&lt; endl;
    return 0;
 }
void testCopyConstructor(stackType&lt;int&gt; otherStack)
{
     if (!otherStack.isEmptyStack())
         cout &lt;&lt; "otherStack is not empty." &lt;&lt; endl; 
         cout &lt;&lt; "The top element of otherStack: " &lt;&lt; otherStack.top() &lt;&lt; endl;
}
</code></pre>

<p>Can anyone help me figure out how to fix the errors so I can get it to compile and build correctly, thanks in advance for any help I receive.</p>
