3
votes

I'm using Eclipse CDT with Cygwin. I have a basic Hello World program that compiles with Eclipse. When I launch the .exe manually, it works fine.

When I hit the debug button in Eclipse, it runs until the first cin. I type a response, hit enter, and nothing happens. I can keep entering responses, and it never gets past that line.

If I then switch to the gdb console and type anything and hit enter, it finally returns from the cin call with the first string I entered, and runs until the next prompt, where the program terminates.

Before, it seemed like it was doing strange things like reading strings from the gdb console.

If I put

set new-console on

in the GDB Command File (under Debug Configurations -> Debugger), it opens a new console and works perfectly. I'm just curious as to what I am doing that causes the other issues since this workaround isn't ideal.

1
Thank you for the pointer to "set new-console on"!!! I was having a similar issue with eclipse and cygwin where my code was using the unistd.h function 'write' with a file descriptor of '/dev/console'. This works fine in the system shell but not in the Eclipse console. - Dan

1 Answers

1
votes

For anyone looking, this is actually a bug in Eclipse on Windows.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=173732