fatal error LNK1120: 2 unresolved externals

this is my code please help me

#include<iostream>
#include<cassert>
using namespace std;

#ifndef ARRAYLIST_H
#define ARRAYLIST_H

template<class elemType>
class ArrayList
{
public:
bool isEmpty();
bool isFull();
void print()const;
int seqSearch(const elemType& item);
void insert(const elemType& insertItem);
void insertEnd(const elemType& insertItem);
void Remove(const elemType& removeItem);
void RemoveAt(int location);
void insertAt(int location, const elemType& insertItem);
void clearList();
void replaceAll(const elemType& c1, const elemType& c2);
ArrayList(int size=100);
ArrayList(const ArrayList<elemType>& otherList);
~ArrayList();

protected:
int length;
int maxSize;
elemType *list;
};
#endif

#include"ArrayList.h"

template <class elemType>
bool ArrayList<elemType>::isEmpty()
{
return (length == 0);
}

template <class elemType>
bool ArrayList<elemType>::isFull()
{
return (length == maxSize);
}

template <class elemType>
void ArrayList<elemType>::print()const
{
for(int i = 0; i < length; i++)
cout<<list[i]<<" ";
cout<<endl;
}
template <class elemType>
void ArrayList<elemType>::insertAt
(int location, const elemType& insertItem)
{
if(location < 0 || location >= maxSize)
cerr<<"The position of the item to be inserted "
<<"is out of range."<<endl;
else
if(length >= maxSize) //list is full
cerr<<"Cannot insert in a full list"<<endl;
else
{
for(int i = length; i > location; i--)
list[i] = list[i - 1]; //move the elements down

list[location] = insertItem; //insert the item at the
//specified position

length++; //increment the length
}
} //end insertAt

template <class elemType>
void ArrayList<elemType>::insertEnd(const elemType& insertItem)
{
if(length >= maxSize) //the list is full
cerr<<"Cannot insert in a full list."<<endl;
else
{
list[length] = insertItem; //insert the item at the end
length++; //increment length
}
} //end insertEnd

template <class elemType>
void ArrayList<elemType>::RemoveAt(int location)
{
if(location < 0 || location >= length)
cerr<<"The location of the item to be removed "
<<"is out of range."<<endl;
else
{
for(int i = location; i < length - 1; i++)
list[i] = list[i+1];

length--;
}
} //end removeAt
template <class elemType>
void ArrayList<elemType>::clearList()
{
length = 0;
} // end clearList

template <class elemType>
int ArrayList<elemType>::seqSearch(const elemType& item)
{
int loc;
bool found = false;

for(loc = 0; loc < length; loc++)
if(list[loc] == item)
{
found = true;
break;
}

if(found)
return loc;
else
return -1;
} //end seqSearch

template <class elemType>
void ArrayList<elemType>::insert(const elemType& insertItem)
{
int loc;

if(length == 0) //list is empty
list[length++] = insertItem; //insert the item and
//increment the length
else
if(length == maxSize)
cout<<"Cannot insert in a full list."<<endl;
else
{
loc = seqSearch(insertItem);

if(loc == -1) //the item to be inserted
//does not exist in the list
list[length++] = insertItem;
else
cerr<<"the item to be inserted is already in "
<<"the list. No duplicates are allowed."<<endl;
}
} //end insert

template <class elemType>
void ArrayList<elemType>::Remove(const elemType& removeItem)
{
int loc;

if(length == 0)
cerr<<"Cannot delete from an empty list."<<endl;
else
{
loc = seqSearch(removeItem);

if(loc != -1)
RemoveAt(loc);
else
cout<<"The tem to be deleted is not in the list."
<<endl;
}

} //end remove


template <class elemType>
ArrayList<elemType>::ArrayList(int size)
{
if(size < 0)
{
cerr<<"The array size must be positive. Creating "
<<"an array of size 100. "<<endl;

maxSize = 100;
}
else
maxSize = size;

length = 0;

list = new elemType[maxSize];
assert(list != NULL);
}

template <class elemType>
ArrayList<elemType>::~ArrayList()
{
delete [] list;
}

//copy constructor
template <class elemType>
ArrayList<elemType>::ArrayList
(const ArrayList<elemType>& otherList)
{
maxSize = otherList.maxSize;
length = otherList.length;
list = new elemType[maxSize]; //create the array
assert(list != NULL); //terminate if unable to allocate
//memory space

for(int j = 0; j < length; j++) //copy otherList
list [j] = otherList.list[j];
}//end copy constructor

template <class elemType>
void ArrayList<elemType>::replaceAll(const elemType& c1, const elemType& c2)
{
if(isEmpty())
cout<<" \n";
else
{
for(int loc=0; loc<length; loc++)
if (loc==seqSearch(c1))
list[loc]=c2;
}

}

#include"ArrayList.h"

void main()

{
ArrayList<char>x(5);


}
when I try to implement an object I get this message:
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall ArrayList<char>::ArrayList<char>(int)" (??0?$ArrayList@D@@QAE@H@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall ArrayList<char>::~ArrayList<char>(void)" (??1?$ArrayList@D@@QAE@XZ) referenced in function _main
1>C:\Users\shahid\documents\visual studio 2012\Projects\ArrayList\Debug\ArrayList.exe : fatal error LNK1120: 2 unresolved externals

please what should I do?
Last edited on
Topic archived. No new replies allowed.