类模板使用时遇到undefined reference to的错误

#include
using namespace std;
const int Max=20;
template
class stack
{
private:
T s[Max];
int index;
public:
int getindex()
{
return index;
}
void push(T a)
{
s[index]=a;
index ++;

}
T pop(){

        return s[index--];
    }
    T getElement(int n)
    {
        return s[n];
    }
    bool stackempty()
    {
        if (getindex()>0)
        return false;
        else
        return true;
    }
    bool stackfull()
    {
        if(getindex()>=19)
        return true;
        else 
        return false;
    }
    stack();
    ~stack();

};
int main()
{
stack s1;
stack s2;
stack s3;
int a;
double b;
char c;
cout<<"store numbers in s1"< while(!s1.stackfull())
{
cin>>a;
s1.push(a);
}
cout<<"store numbers in s2"< while(!s2.stackfull())
{
cin>>b;
s2.push(b);
}
cout<<"store numbers in s3"< while (!s3.stackfull())
{
cin>>c;
s3.push(c);
}
int x,y,z;
cout<<"you want nth number?"< int n;
cin>>n;
x=s1.getElement(n);
y=s2.getElement(n);
z=s3.getElement(n);
while (!s1.stackempty())
{
s1.pop();
}
while(!s2.stackempty())
{
s2.pop();
}
while (!s3.stackempty())
{
s3.pop();
}
if(s1.stackempty()&&s2.stackempty()&&s3.stackempty())
cout<<"well done!"< return 0;
}
C:\Users\ADMINI~1\AppData\Local\Temp\ccwOSvvK.o In function `main':
48 undefined reference to `stack::stack()'
49 undefined reference to stack<double>::stack()'
50 undefined reference to
stack::stack()'
50 undefined reference to stack<char>::~stack()'
49 undefined reference to
stack::~stack()'
93 undefined reference to stack<int>::~stack()'
50 undefined reference to
stack::~stack()'
49 undefined reference to stack<double>::~stack()'
93 undefined reference to
stack::~stack()'
[Error] ld returned 1 exit status

跪求把排版搞好点啊,这代码太乱,10个看你问题的至少9个看一眼就点了右上角的X。