0
votes

Need help to resolve an error.

Currently I am working on a migration project from visual c++ 6.0 to visual studio c++ 2005.

And during compilation, I am getting "Undeclared Identifier Error"

I am hearing pasting the code and error.

code

const SMbfIndexCash* GetIxCashed(const CPoint& ptIxBlock, const short nMbfID) {

            SMbfIndexCash* pCashFound;

            for(int ixFound=0; ixFound<MBF_IX_CASH_SIZE; ixFound++)
            {      
             pCashFound=&ElementAt(ixFound);

                    if(pCashFound->nAge<0)
                            return NULL;
                    if(nMbfID==pCashFound->nMbfID && ptIxBlock==pCashFound->ptIxBlock)      
                            break;
            }
            if(ixFound==MBF_IX_CASH_SIZE)
                    return NULL;

    }

Error.

1>c:\cm and nemesis\cm code\cm 8.16\cm 8.16.0.1\source\cmoslib\tile.h(466) : error C2065: 'ixFound' : undeclared identifier

Thank you.

1
Project > Properties > C/C++ > Language > Force Conformance in For Loop Scope = No.Hans Passant

1 Answers

1
votes

The ixFound is now local to the scope of the for loop.

you need to do something like:

int ixFound = 0;
for(ixFound=0; ixFound<MBF_IX_CASH_SIZE; ixFound++)
{
//...
}
//...