Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm using Visual Studio 2013, programming in C++ and have a base class with the following attribute:

ref class AI
{

...

protected:

   /// <summary>
   /// Exit found flag. False if exit is yet to be found, true if it already was.
   /// </summary>
   bool exitFound;

...

}

Within the derived class I have the following code:

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){...}
        }

...

}

And I don't know how, but when running or debugging, the if (this->exitFound) statement is always skipped. When debugging I get the "The breakpoint will not currently be hit..." message.

I already tried to clean the solution, but no success so far. Anyone can help me find what is wrong?

like image 717
marceloatg Avatar asked Dec 14 '25 08:12

marceloatg


1 Answers

Select in Visual Studio [Properties] - [Build] tab and check [Define DEBUG constant] and [Define TRACE constant] are checked. Also check [Debug Info] is set to [full] in [Advanced] tab.

like image 63
Dmitry Kazakov Avatar answered Dec 16 '25 21:12

Dmitry Kazakov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!