当我的代码调用某个函数时,我得到一个错误:
错误22错误LNK2019:未解析的外部符号“public:void
__此调用Shalishut::Task8\u将车辆从基础移动到基础(类
*)" (?任务8\u将车辆从基地移动到基地@Shalishut@@QAEXPAVMilitary@@PBDPAD2@Z)
在函数“public:void”中引用
__thiscall Manager::TaskExecute(类Task*,类Military*,类
Shalishut*,字符**常量)
(?TaskExecute@Manager@@QAEXPAVTask@@PAVMilitary@@PAVShalishut@@QAPAD@Z)
H:\工作区\HW5\HW5\经理.objH用法:\workspace\HW5\HW5\经理.obj
当我不调用那个函数时,一切都正常,项目就开始构建了。
下面是调用函数的代码:
shalishut->Task8_MoveVehicleFromBaseToBase(military,licenseId,campNameA,campNameB);
下面是函数:
void Task8_MoveVehicleFromBaseToBase(Military* military,const char* licenseId,char* fromBase,char* toBase){
if (military->IsBaseExist(fromBase)){
if(military->FindBase(fromBase)->IsVehicleExist(licenseId)){
if (military->IsBaseExist(toBase)){
if(military->GetCountry()->IsRoadExist(military->FindBase(fromBase)->GetCityName(),military->FindBase(toBase)->GetCityName())){
military->FindBase(toBase)->AddVehicleToBase( military->FindBase(fromBase)->RemoveVehicleFromBase(licenseId) );
Time* time = Time::GetInstance();
long double distance = military->GetCountry()->GetRoadDistance(military->FindBase(fromBase)->GetCityName(),military->FindBase(toBase)->GetCityName());
Transport* transportToAdd = new Transport(time->GetTime(),(string)fromBase,(string)toBase,distance);
military->FindVehicle(licenseId)->AddTransport(transportToAdd);
}
}
}
}
}