Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Watch expression in C/C++ Project is possible??
Watch expression in C/C++ Project is possible?? [message #817749] Sat, 10 March 2012 15:41 Go to next message
Carlos Qarl is currently offline Carlos QarlFriend
Messages: 12
Registered: March 2012
Junior Member
Hi!!

I'm try to view the result of a "if" sentence, but I don't know how to do. Confused
Is possible do this in C Project or.. is only for Java Project?

Regards and sorry for my very bad English! Embarrassed
Re: Watch expression in C/C++ Project is possible?? [message #819081 is a reply to message #817749] Mon, 12 March 2012 13:19 Go to previous messageGo to next message
Carlos Qarl is currently offline Carlos QarlFriend
Messages: 12
Registered: March 2012
Junior Member
Please, anyone can help me??
I want known the result of this sentence, for example:

if(i==5)
{
     break;
}
Re: Watch expression in C/C++ Project is possible?? [message #819105 is a reply to message #819081] Mon, 12 March 2012 13:50 Go to previous messageGo to next message
Fabien Bourrel is currently offline Fabien BourrelFriend
Messages: 14
Registered: February 2012
Junior Member
Hi,
I don't see what you mean saying "the result of a 'if' sentence".

For your example, this code is useless, the 'break' will put you out of the 'if' sequence.

Could you be more accurate about what you expect to do?

Maybe you should have a look at the Breakpoint?

[Updated on: Mon, 12 March 2012 13:52]

Report message to a moderator

Re: Watch expression in C/C++ Project is possible?? [message #819245 is a reply to message #819105] Mon, 12 March 2012 17:10 Go to previous messageGo to next message
Carlos Qarl is currently offline Carlos QarlFriend
Messages: 12
Registered: March 2012
Junior Member
Sorry for my bad explanation.

I want see if a condition sentence is true or false (in the debugger at run time, obviously!).
New example:
int i;
cin << i;
if(i == 5) // I want see if this condition return true or false at runtime.
{
    cout << "This is the number secret!! :)"
}
else
{
    cout << "Sorry, try again! :("
}
Re: Watch expression in C/C++ Project is possible?? [message #819738 is a reply to message #819245] Tue, 13 March 2012 09:14 Go to previous messageGo to next message
Fabien Bourrel is currently offline Fabien BourrelFriend
Messages: 14
Registered: February 2012
Junior Member
You may add some BreakPoint into your then and else statement.
You just have to right click on the column where markers are shown and use 'Toggle Breakpoint'. There will be a blue point facing the line.
Then, you run a debug, and the execution will normally stop when it reaches the line containing the breakpoint.
In the debug view, you could see all the environment there is during the execution.

Hope it helps,
Fabien
Re: Watch expression in C/C++ Project is possible?? [message #819796 is a reply to message #819245] Tue, 13 March 2012 10:38 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Carlos Solano wrote on Mon, 12 March 2012 18:10
Sorry for my bad explanation.

I want see if a condition sentence is true or false (in the debugger at run time, obviously!).
New example:
int i;
cin << i;
if(i == 5) // I want see if this condition return true or false at runtime.
{
    cout << "This is the number secret!! :)"
}
else
{
    cout << "Sorry, try again! :("
}

So you want a conditional breakpoint? Set a breakpoint and then open the context menu of the breakpoint (right click on the blue circle) and choose "Breakpoint properties..."


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:libxml2
Next Topic:How to edit makefile in Eclipse GUI
Goto Forum:
  


Current Time: Thu Mar 28 17:49:51 GMT 2024

Powered by FUDForum. Page generated in 0.03966 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top