C ++,VS2005请帮我解决这个编译错误

时间:2015-10-19 08:14:54

标签: visual-c++

代码

   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

1 个答案:

答案 0 :(得分:0)

$ sudo apt-get install libclutter-gtk-1.0-0 ...变量“ixObj”仅在... libclutter-gtk-1.0-0 is already the newest version 循环的范围内定义,并且在外部未知。

在循环之前定义整数,并从'for'中删除decalration:

for(int ixObj