Debugger problem with cout / cin [message #652775] |
Sun, 06 February 2011 16:37 |
Carsten Messages: 2 Registered: February 2011 |
Junior Member |
|
|
Hi everybody,
I am having problems debugging this code:
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char * argv[]) {
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
cout << "======================\n";
cout << "Press 'Return' to quit: ";
cin.get();
return 0;
}
I get this output in the console:
Press 'Return' to quit: *stopped,reason="end-stepping-range",frame={addr="0x0040144e",func="main",args=[{name="argc",value="1"},{name="argv",value="0x524438"}],file="..\getchTest.cpp",fullname="C:/Dokumente und Einstellungen/Normal/workspace/getchTest/.settings/..\getchTest.cpp",line="13"},thread-id="1",stopped-threads="all"
When I run the program normaly all is working as expected.
As you can see I already stumbled over the CDT FAQ (I put that setvbuff stuff in the code).
But that does not seem to help for debugging.
I am running Windows XP.
Eclipse:
Eclipse C/C++ Development Tools
Version: Helios Service Release 1
Build id: 20100917-0705
I installed MinGW via Wascana MinGW Tools and Base SDK 0.9.9.0a
which gives me:
GCC: 4.4.1
GDB: 7.1
I found a thread in this forum about some similar problem but no solution there either.
Can anybody help?
Thanks a lot,
Carsten
|
|
|
|
|
|
Re: Debugger problem with cout / cin [message #1064440 is a reply to message #652775] |
Wed, 19 June 2013 09:30 |
Nenad Bulatovic Messages: 3 Registered: June 2013 |
Junior Member |
|
|
I had same problem every time I was using cin right after cout, and finally I resolved it with adding << endl; after cout
bool isDone()
{
char c;
cout << "Enter 'Y' if food is done:";
cin >> c;
return ((c == 'Y') || (c == 'y'));
}
This was generating error such as:
*stopped,reason="end-stepping-range",frame=...
But this is working just fine:
bool isDone()
{
char c;
cout << "Enter 'Y' if food is done:" << endl;
cin >> c;
return ((c == 'Y') || (c == 'y'));
}
[Updated on: Wed, 19 June 2013 09:37] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05308 seconds