0

I recently started using Eclipse CDT (version 2019-03) with the Cygwin toolchain and have noticed some bizarre behaviour when using the debugger.

Under the debugger the following program behaves as you would expect

#include <iostream>

int main()
{
    std::cout << "hello world\n" << std::flush;
}

However the following produces no output

#include <iostream>

int main()
{
    std::cout << "* world\n" << std::flush;
}

And for the following the output is world

#include <iostream>

int main()
{
    std::cout << "@ world\n" << std::flush;
}

This behaviour is completely consistent and reproduceable. Does anyone have any explanation or workarounds?

john
  • 85,011
  • 4
  • 57
  • 81
  • I've had similar problems with another IDE (CLion), and my ugly workaround then was to ask for input (e.g. `std::cout << "Press enter to continue"; std::getline(std::cin, dummy_line);`) – Some programmer dude Jun 13 '19 at 07:20
  • 1
    The top answer here, https://stackoverflow.com/questions/14324487/eclipse-debugging-with-input-from-console is a workaround. Still interested to know WTF is going on. – john Jun 13 '19 at 07:26
  • @Someprogrammerdude I have another problem where sometimes it seems there is pending input in the console even when the program has just launched, so asking for input is also behaviing strangely for me. – john Jun 13 '19 at 07:27

0 Answers0