Problem debugging when using iostream cin after cout

General questions regarding the usage of CodeLite
Millard
CodeLite Curious
Posts: 1
Joined: Mon Aug 15, 2011 11:28 pm
Genuine User: Yes
IDE Question: C++
Contact:

Problem debugging when using iostream cin after cout

Post by Millard »

Hi, I'm trying to run the CodeLite debugger on a very very simple C++ program, such as:

Code: Select all

#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
 int number;
 cout << "Enter a Number: ";
 cin >> number;
 cout << "Your Number Was: " << number;
 return 0;
}
If I have no "\n" newline or << endl at the end of the cout, this will not work properly in the CodeLite debugger. I've tried this in the most recent version on both Ubuntu Linux and Mac OS X. The "cin" never assigns whatever is typed in the debugger window to the local variable which remains 0. I tried various cout.flush() and cin.sync() operations to no avail. However, adding a simple newline fixes this problem, but, of course, prompts for user input on a new line. I should add that this code runs as expected in the terminal.

Any suggestions would be greatly appreciated.