【问题标题】:vc++ undeclared indentifier 2015C++ 未声明的标识符 2015
【发布时间】:2015-10-16 13:46:08
【问题描述】:

需要帮助来解决错误。

目前我正在进行从 Visual c++ 6.0 到 Visual Studio c++ 2005 的迁移项目。

在编译期间,我收到“未声明的标识符错误”

我听到粘贴代码和错误。

代码

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;

    }

错误。

1>c:\cm 和克星\cm 码\cm 8.16\cm 8.16.0.1\source\cmoslib\tile.h(466):错误 C2065:'ixFound': 未声明的标识符

谢谢。

【问题讨论】:

  • 项目 > 属性 > C/C++ > 语言 > For 循环范围内的强制一致性 = 否。

标签: visual-c++ visual-studio-2015


【解决方案1】:

ixFound 现在在 for 循环的范围内是本地的。

您需要执行以下操作:

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

【讨论】:

    猜你喜欢
    • 2018-05-03
    • 1970-01-01
    • 1970-01-01
    • 2012-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多