Hi, I am trying to use debugging in Xcode, specifically "edit breakpoint" part.
So I have loop:"
for(int i = 0 ; i < 10; ++i){
}
return 0;
"
And I set a breakpoint inside the loop, then I edit the breakpoint condition: "i>5" and log message: The current value for I is: $i
The error I got: "use of undeclared identifier 'i'
Could anybody help me solve the error? Thank you!
You have to wrap the variable you are logging with the @ character, @i@
, instead of $i
. The message you log should be the following:
The current value for I is: @i@
Read the following article for more details:
https://www.swiftdevjournal.com/replace-swift-print-statements-with-xcode-breakpoint-actions/
The article talks about Swift code, not C++, but the material applies to C++ code as well.