There is no output being displayed in the terminal during the debug process, it is only displayed after the program has finished executing.
This is during the debug process:
This is after the debug process:
Why is this happening, and how can I get the output to appear during debugging at my breakpoint?
This is probably due to buffering. See Is std::cout buffered? (answer: yes it is buffered). You can manually flush cout
in two ways:
Use the std::flush
manipulator:
std::cout << std::flush;
Use the std::basic_ostream<CharT,Traits>::flush
member function:
std::cout.flush();
As for why the output appears when your program exits, that's because the C++ specification mandates that all open C streams with unwritten buffered data be flushed at program exit. See Is there a guarantee of stdout auto-flush before exit? How does it work?.