0

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 during the debug process

This is after 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?

starball
  • 20,030
  • 7
  • 43
  • 238

1 Answers1

0

This is probably due to buffering. See Is std::cout buffered? (answer: yes it is buffered). You can manually flush cout in two ways:

  1. Use the std::flush manipulator:

    std::cout << std::flush;
    
  2. 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?.

starball
  • 20,030
  • 7
  • 43
  • 238