User forums > Using Code::Blocks

debuging the code: how add variables and arrays objects to watches window?

(1/5) > >>

cambalinho:
the watches window adds, automatic, local variables but not what i need to test. for that i nee do it manually(select the variable and then click on right button for add it to watches window).
until here fine, but see these: i have a class button with a getTop() function member.


--- Code: ---vector<button> btnarray;
int WinMain()
{
    //int arraysize=ArraySize(btnarray, button);//geting the array size
    btnarray.resize(8);

    for (int i=0; i<btnarray.size(); i++)
    {
        int b=100 + ((i+1)*50);
        btnarray[i].setTop(b);
        //OutputDebugStr(to_string(btnarray[i].getTop()).c_str());
        btnarray[i].setLeft(0);
        btnarray[i].setText(to_string(i));
        btnarray[i].MouseClick=[i]()
        {
            MessageBox(btnarray[i].getText());
        };
    }

--- End code ---
now heres the questions points:
- how can i add the btnarray [ i ].getTop() to watches window and see it's value?
- how can i see the string of OutputDebugStr() on debug mode?

oBFusCATed:
1. Select it and wait for the popup to show up or right click -> add watch
2. This is more of a gdb question, but have you tried to enable the debug output in the settings -> debugger?

cambalinho:
for that i must, 1st, enter\execute on debug mode. on watches window, on value section, i get 'Not available'. what means? why i can't get it's value? or is because i'm not using on code?

oBFusCATed:
GDB can execute function, but I'm not sure what are the requirements. Sometimes it just fails.

BTW. I have really hard time understanding what you're talking about, please try harder to explain what you're doing.

cambalinho:
i'm trying using the watches windows for see the btnarray.getTop() value. and send some messages, for test other values, for watches window

Navigation

[0] Message Index

[#] Next page

Go to full version