【问题标题】:Visual C++ if statement. The breakpoint will not currently be hitVisual C++ if 语句。断点当前不会被命中
【发布时间】:2015-07-19 05:35:46
【问题描述】:

我正在使用 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-&gt;exitFound) 语句。调试时,我收到“断点当前不会被命中...”消息。

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

【问题讨论】:

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


【解决方案1】:

在 Visual Studio [Properties] - [Build] 选项卡中选择并勾选 [Define DEBUG constant] 和 [Define TRACE constant] 被勾选。还要检查 [高级] 选项卡中的 [调试信息] 是否设置为 [完整]。

【讨论】:

  • 感谢您的建议!这只是一个编译器优化问题。
猜你喜欢
  • 1970-01-01
  • 2013-03-09
  • 1970-01-01
  • 2018-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-26
  • 1970-01-01
相关资源
最近更新 更多