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?

3
  • 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);) Commented Jun 13, 2019 at 7:20
  • 1
    The top answer here, stackoverflow.com/questions/14324487/… is a workaround. Still interested to know WTF is going on. Commented Jun 13, 2019 at 7: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. Commented Jun 13, 2019 at 7:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.