Code Bye

C++ error LNK2019: 无法解析的外部符号

C++

1>ShortestPath.obj : error LNK2019: 无法解析的外部符号 “private: class std::map<int,int,struct std::less<int>,class std::allocator<struct std::pair<int const ,int> > > __thiscall CShortestPath::GetStopList(class _com_ptr_t<class _com_IIID<struct IFeature,&struct __s_GUID const _GUID_d4803ee9_79f4_11d0_97fc_0080c7f79481> >,class _com_ptr_t<class _com_IIID<struct IFeatureClass,&struct __s_GUID const _GUID_d4803ee6_79f4_11d0_97fc_0080c7f79481> >)” ( GetStopList@CShortestPath@@AAE AV $map@HHU $less@H@std@@V $allocator@U $pair@$$CBHH@std@@@2@@std@@V $_com_ptr_t@V $_com_IIID@UIFeature@@$1 _GUID_d4803ee9_79f4_11d0_97fc_0080c7f79481@@3U__s_GUID@@B@@@@V $_com_ptr_t@V $_com_IIID@UIFeatureClass@@$1 _GUID_d4803ee6_79f4_11d0_97fc_0080c7f79481@@3U__s_GUID@@B@@@@@Z),该符号在函数 “private: void __thiscall CShortestPath::InitCentroid(class _com_ptr_t<class _com_IIID<struct IFeatureClass,&struct __s_GUID const _GUID_d4803ee6_79f4_11d0_97fc_0080c7f79481> >,class _com_ptr_t<class _com_IIID<struct IFeatureClass,&struct __s_GUID const _GUID_d4803ee6_79f4_11d0_97fc_0080c7f79481> >)” ( InitCentroid@CShortestPath@@AAEXV $_com_ptr_t@V $_com_IIID@UIFeatureClass@@$1 _GUID_d4803ee6_79f4_11d0_97fc_0080c7f79481@@3U__s_GUID@@B@@@@0@Z) 中被引用



求解决。。。
//结构体
struct Centroid
{
	position location;
	map<int,int> stopList;
};

struct POI
{
	position location;
	map<int,int> stopList;
};


//函数
 map<int,int>  GetStopList(IFeaturePtr centroid,IFeatureClassPtr Stop)
 {
	 ISelectionSetPtr pSelSet;
	 int m_Radius=300;
	 map<int,int> stopList;
	 IGeometryPtr pGeometry;
	 IPointPtr pPoint=(IPointPtr)pGeometry;
	 IGeometryPtr pBuffer;
	 ITopologicalOperatorPtr pTopo;
	 pTopo->Buffer(m_Radius,&pBuffer);
	 ISpatialFilterPtr pFilter;
	 pFilter->putref_Geometry(pBuffer);
	 pFilter->put_SpatialRel(esriSpatialRelIntersects);
	 IDatasetPtr pSet=(IDatasetPtr)Stop;
	 IWorkspacePtr pWorkSpace;
	 pSet->get_Workspace(&pWorkSpace);
	 Stop->Select(pFilter,esriSelectionTypeHybrid,esriSelectionOptionNormal,pWorkSpace,&pSelSet);
	 long sum;
	 pSelSet->get_Count(&sum);
	 while (sum==0)
	 {
		 m_Radius*=2;
		 pTopo->Buffer(m_Radius,&pBuffer);
		 pFilter->put_SpatialRel(esriSpatialRelIntersects);
		 Stop->Select(pFilter,esriSelectionTypeHybrid,esriSelectionOptionNormal,pWorkSpace,&pSelSet);
		 pSelSet->get_Count(&sum);
	 }
	 long idxStopID;
	 Stop->FindField(_T("StopID"),&idxStopID);
	 esriICursorPtr pCursor;
	 pSelSet->Search(NULL,false,&pCursor);
	 IFeatureCursorPtr pFeatureCursor=(IFeatureCursorPtr)pCursor;
	 IFeaturePtr pStop;
	 pFeatureCursor->NextFeature(&pStop);
	 VARIANT tempStopID;
	 int tempWalkTime;
	 while(pStop!=NULL)
	 {
		 pStop->get_Value(idxStopID,&tempStopID);
		 tempWalkTime=GetWalkTime(centroid,pStop);
		 stopList.insert(map<int,int>::value_type(tempStopID.intVal,tempWalkTime));
		 pFeatureCursor->NextFeature(&pStop);
	 }
	 return  stopList;
 }

 void CShortestPath::InitCentroid(IFeatureClassPtr CentroidClass,IFeatureClassPtr Stop )
 {
	 long  count,idxCentroidID;
	 CentroidClass->FindField(_T("CentroidID"),&idxCentroidID);
     CentroidClass->FeatureCount(NULL,&count);
	 centroidList=new Centroid[count];
	 IFeatureCursorPtr pFeatureCursor;
	 CentroidClass->Search(NULL,false,&pFeatureCursor);
	 IFeaturePtr pCentroid;
	 pFeatureCursor->NextFeature(&pCentroid);
	 VARIANT tempCentroidID;
	 IGeometryPtr pGeometry;
	 IPointPtr pPoint;
	 double tempX,tempY;
	 while (pCentroid!=NULL)
	 {
		 pCentroid->get_Value(idxCentroidID,&tempCentroidID);
		 centroidList[tempCentroidID.intVal].stopList=GetStopList(pCentroid,Stop);
		 pCentroid->get_ShapeCopy(&pGeometry);
		 pPoint=(IPointPtr)pGeometry;
		 pPoint->get_X(&tempX);
		 pPoint->get_Y(&tempY);
		 centroidList[tempCentroidID.intVal].location.x=tempX;
		 centroidList[tempCentroidID.intVal].location.y=tempY;
		 pFeatureCursor->NextFeature(&pCentroid);
	 }

 }

 void CShortestPath::InitPOI(IFeatureClassPtr POIClass,IFeatureClassPtr Stop )
 {
	 long  count,idxPOIID;
	 POIClass->FindField(_T("GoalID"),&idxPOIID);
	 POIClass->FeatureCount(NULL,&count);
	 poiList=new POI[count];
	 IFeatureCursorPtr pFeatureCursor;
	 POIClass->Search(NULL,false,&pFeatureCursor);
	 IFeaturePtr pPOI;
	 pFeatureCursor->NextFeature(&pPOI);
	 VARIANT tempPOIID;
	 IGeometryPtr pGeometry;
	 IPointPtr pPoint;
	 double tempX,tempY;
	 while (pPOI!=NULL)
	 {
		 pPOI->get_Value(idxPOIID,&tempPOIID);
		 poiList[tempPOIID.intVal].stopList=GetStopList(pPOI,Stop);
		 pPOI->get_ShapeCopy(&pGeometry);
		 pPoint=(IPointPtr)pGeometry;
		 pPoint->get_X(&tempX);
		 pPoint->get_Y(&tempY);
		 centroidList[tempPOIID.intVal].location.x=tempX;
		 centroidList[tempPOIID.intVal].location.y=tempY;
		 pFeatureCursor->NextFeature(&pPOI);
	 }
 }

20分

map<int,int> GetStopList(IFeaturePtr centroid,IFeatureClassPtr Stop)
没有加类名限制:CShortestPath
map<int,int> CShortestPath::GetStopList(IFeaturePtr centroid,IFeatureClassPtr Stop)

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明C++ error LNK2019: 无法解析的外部符号