Visual c++ C++;,VS2005请帮助我解决此编译错误
代码Visual c++ C++;,VS2005请帮助我解决此编译错误,visual-c++,Visual C++,代码 BOOL CGrAllObjects::ReorderObj(CGrObject*pGrFind,int-ixObjNewIx) { int nSubCode,nLyrCode=pGrFind->GetLayerCode(nSubCode); CGrObject*pGrObject; CGrObjectArray* pGrObjectArray=GetObjArrayFromCode(nLyrCode,nSubCode); 如果(!pGrObjectArray)返回FALSE; 对于(in
BOOL CGrAllObjects::ReorderObj(CGrObject*pGrFind,int-ixObjNewIx)
{
int nSubCode,nLyrCode=pGrFind->GetLayerCode(nSubCode);
CGrObject*pGrObject;
CGrObjectArray*
pGrObjectArray=GetObjArrayFromCode(nLyrCode,nSubCode);
如果(!pGrObjectArray)返回FALSE;
对于(int-ixObj=pGrObjectArray->GetSize()-1;ixObj>=0;ixObj--)
{pGrObject=pGrObjectArray->GetAt(ixObj);
如果(pGrObject==pGrFind)中断;
}
if(ixObjRemoveAt(ixObj);
pGrObjectArray->InsertAt(ixObjNewIx,pGrFind);
}
返回TRUE;
}
错误:1>c:\xxx\xxx\xxxx\xxxx\xxxx\xxxxx\xxxxx.cpp(359):错误C2065:
“ixObj”:未声明的标识符
for(int-ixObj
…变量“ixObj”仅在for
循环的范围内定义,外部未知
在循环之前定义整数,并从“for”中删除贴花:
BOOL CGrAllObjects::ReorderObj(CGrObject* pGrFind,int ixObjNewIx)
{
int nSubCode,nLyrCode=pGrFind->GetLayerCode(nSubCode);
CGrObject* pGrObject;
CGrObjectArray*
pGrObjectArray=GetObjArrayFromCode(nLyrCode,nSubCode);
if(!pGrObjectArray) return FALSE;
for(int ixObj=pGrObjectArray->GetSize()-1; ixObj>=0; ixObj--)
{ pGrObject=pGrObjectArray->GetAt(ixObj);
if(pGrObject==pGrFind) break;
}
if(ixObj<0) return FALSE;
if(ixObj!=ixObjNewIx)
{ pGrObjectArray->RemoveAt(ixObj);
pGrObjectArray->InsertAt(ixObjNewIx,pGrFind);
}
return TRUE;
}
Error: 1>c:\xxx\xxx\xxxx\xxxx\xxxx\xxxxx\xxxx.cpp(359) : error C2065:
'ixObj' : undeclared identifier
int ixObj;
for(ixObj=...