skip to Main Content

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


  1. It seems your question is: How do I change a variable while debugging with Xcode?

    For simple types like int and double, it’s very straightforward. Option-click on the variable and select Edit Value…. Then the value turns into an editable text field.

    enter image description here

    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 the string object’s assign() function:

    call str.assign("xyz")
    

    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.

    enter image description here

    Login or Signup to reply.
  2. To enable input through std::cin switch debug output window mode from "All Output" to "Target Output".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search