Visual C++ if语句。断点目前无法命中。

3

我使用的是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)语句总是被跳过。在调试时,我收到了“断点当前无法命中...”的消息。

我已经尝试清理解决方案,但迄今没有成功。有人能帮助我找出问题所在吗?


你确定你没有在调试发布(优化)版本吗?https://dev59.com/HX_aa4cB1Zd3GeqPziy3#23349047 - PaulMcKenzie
1个回答

2

在Visual Studio中选择[属性] - [生成]选项卡,并检查已选中[定义DEBUG常量]和[定义TRACE常量]。还要检查[高级]选项卡中的[调试信息]设置为[完整]。


2
谢谢您的建议!这只是一个编译器优化问题。 - marceloatg

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接