所以我一直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