所以我一直tryind创建一个简单的数组列表类,并得到了在一开始媒体链接卡住...林坚持与C++中的模板类
我的头文件(我删除了我的cpp文件,并仍然得到了同样的信息)
#ifndef ARRAYLIST_H
#define ARRAYLIST_H
#include <iostream>
using namespace std;
template <typename T>
class ArrayList {
private:
T *arr;
int length;
public:
ArrayList();
void Insert(T item);
void Print();
//friend &ostream operator<< (ostream &out, ArrayList &al);
};
#endif
和我的错误
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall ArrayList<int>::ArrayList<int>(void)" ([email protected]@@[email protected]) referenced in function _main
1>C:\Users\Gannash\Desktop\Programming\C++WS\XMLReader\Debug\XMLReader.exe : fatal error LNK1120: 1 unresolved externals
嗯,你已经声明了三个成员函数,在哪里定义? – ildjarn 2012-02-10 23:08:47