Reputation: 33
I am currently trying to get the hang of the debugger in Xcode while I am trying to learn C++. I'm coming across a problem where the debugger is not showing any cout output to the console. It just says (lldb)
I've set breakpoints to make sure I don't miss anything: 4 variable outputs
As you can see this piece of code has already been run:
int x = 1;
std::cout << x << " ";
However, the console is still only showing me the following: console output
I can step over each statement and it still won't show anyting but (lldb)
To my knowlegde the debugger should be showing 1 2 4 8 sequentially as I step over/step into each statement. However, the results are only output the console after I finish debugging. My question essentially, why am I not seeing anything being displayed?
For the record this is my first question, if I've not searched well enough or broken any rules please feel free to let me know, thanks in advance.
Upvotes: 3
Views: 1816
Reputation: 4468
You need to terminate your output line, e.g.:
std::cout << x << "\n";
or
std::cout << x << std::endl;
Your output should show up after your have written a line terminator character as in either of the statements above.
Upvotes: 4