Visual c++ if语句.当前不会命中该断点

Visual C++ if statement. The breakpoint will not currently be hit

本文关键字:断点 c++ if 语句 Visual      更新时间:2023-10-16

我使用Visual Studio 2013,用c++编程,并具有以下属性的基类:

ref class AI
{
...
protected:
   /// <summary>
   /// Exit found flag. False if exit is yet to be found, true if it already was.
   /// </summary>
   bool exitFound;
...
}
在派生类中我有以下代码:
void AI_II::analyze(void)
{
...
        this->exitFound = true;
        if (this->exitFound)
        {
            if (this->distFront->lastTile == EXIT){...}
            else if (this->distDown->lastTile == EXIT){...}
            else if (this->distBack->lastTile == EXIT){...}
            else if (this->distUp->lastTile == EXIT){...}
        }
...
}

我不知道为什么,但是在运行或调试时,if (this->exitFound)语句总是被跳过。当调试时,我得到"断点当前不会被击中…"消息。

我已经尝试过清理解决方案,但到目前为止还没有成功。谁能帮我找出问题所在?

在Visual Studio中选择[Properties] - [Build]选项卡并勾选[Define DEBUG constant]和[Define TRACE constant]。在[高级]选项卡中检查[调试信息]设置为[full]