i think my problem is from class Car;but i can not found it ,please help me.
#include <iostream>
void main()
{
int n = rand() % 6;
int time = 1;
for (int i = 0; i < n; i++) {
Car<int> car1; // this place is error
// BianDao.QInsert(car);
int n = 0;
car1.Get_Car_Number(n);
cout << n << endl;
}
}
template <class T>
class Car {
int Car_Number;
int Start_Time;
int Out_Time;
public:
Car(const T &item = 0);
~Car();
bool Get_Car_Number(T &item)
{
item = Car_Number;
return true;
}
bool Get_Start_Time(T &item);
bool Get_Out_Time(T &item);
bool Set_Start_Time(const T &item);
};
template <class T>
Car<T>::Car(const T &item)
: Start_Time(item)
{
Car_Number = 9999 + rand() % 99999;
}
Error:
error LNK2019: 无法解析的外部符号 "public: __thiscall
Car<int>::~Car<int>(void)" (??1?$Car@H@@QAE@XZ),该符号在函数 _main
中被引用 C:\Users\Administrator\documents\visual studio
2013\Projects\停车场管理系统\停车场管理系统\main.obj 停车场管理系统