I can only post this as I have a new account
Hey if there is anyone who uses Xcode for CPP PLEASE HELP ME I have searched everywhere and can not figure out what I am doing wrong. I want to debug but while debugging I want to be able to input values into a variable and I can not figure out how. Please if anyone can help me. Thank you!
I have tried looking everywhere and cannot find the solution anywhere. If needed I can provide a screen shot of my xcode.
2
Answers
It seems your question is: How do I change a variable while debugging with Xcode?
For simple types like
int
anddouble
, it’s very straightforward. Option-click on the variable and select Edit Value…. Then the value turns into an editable text field.For variable of type
string
, it’s more difficult as they are actually complex C++ classes. The easiest approach is to do it in the console and call thestring
object’sassign()
function:Note that the debugger doesn’t immediately realize that the value has changed. So it keeps displaying the old value until you continue to run the code.
To enable input through
std::cin
switch debug output window mode from "All Output" to "Target Output".