顺序栈问题(unresolved external symbol)
求助“unresolved external symbol”问题,小弟最近初学C++,在写顺序栈的时候遇到这个问题,请各位高人帮忙啊!代码我是分开放的,共有三个文件,ArrayStack.h,ArrayStack.cpp,main.cpp
程序代码://ArrayStack.h
//顺序栈类的定义
template<class T>
class ArrayStack
{
int size;
int tos;
T* contain;
public:
ArrayStack():size(0),tos(-1),contain(NULL)
{
}
ArrayStack(int MaxSize);
void Push(T element);
T Pop();
bool IsEmpty();
};//main.cpp
#include "ArrayStack.h"
#include "iostream"
using namespace std;
#define MaxSize 10
//顺序栈功能为完成括号匹配,
int main()
{
ArrayStack<char> small(MaxSize);
char a;
do
{
cin>>a;
switch(a)
{
case '(':
small.Push(a);
break;
case ')':
if(!small.IsEmpty())
{
small.Pop();
break;;
}
if(small.IsEmpty())
{
cout<<"匹配错误!"<<endl;
exit(0);
break;
}
}
}while (a != '0');
if(small.IsEmpty())
{
cout<<"匹配正确!"<<endl;
}
else
{
cout<<"匹配错误!"<<endl;
}
return 0;
}//ArrayStack.cpp#include "ArrayStack.h"
#include "assert.h"
//设定顺序栈的最大容量
template<class T>
ArrayStack< T >::ArrayStack(int MaxSize)
{
size = MaxSize;
tos = -1;
contain = new T[size];
}
//指定元素入栈
template<class T>
void ArrayStack< T >::Push(T element)
{
assert(tos != size-1);
contain[++tos] = element;
}
//栈顶元素出栈
template<class T>
T ArrayStack< T >::Pop()
{
assert(tos != -1);
return contain[tos--];
}
//判断顺序栈是否为空
template<class T>
bool ArrayStack< T >::IsEmpty()
{
return (tos == -1);
}











所以么,就按我说的那么做么!