Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse CDT on Ubuntu 11.10 x64, debugging problems
Eclipse CDT on Ubuntu 11.10 x64, debugging problems [message #831930] Thu, 29 March 2012 14:33 Go to next message
Matteo Eit is currently offline Matteo Eit
Messages: 7
Registered: March 2012
Junior Member
Hi all,

Recently I had to install eclipse cdt indigo on my ubuntu 11.10 64bit pc and everything works except for the console output, even simple code like this will generate an output only when the program is terminated

#include <stdio.h>
#include <stdlib.h>

int i=0;

int main(void) {
	printf("input:");
	scanf("%d", &i);
	printf("\nhey dude, %d\n", i);
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	return EXIT_SUCCESS;
}




5                   // this was my input in console
input:
hey dude, 5
!!!Hello World!!!


I had to input the 5 myself because the execution was stuck waiting for the input even if the first printf was before in the code

Anybody can help me solving this ?

EDIT: even adding fflush(stdin) is not working

[Updated on: Thu, 29 March 2012 14:35]

Report message to a moderator

Re: Eclipse CDT on Ubuntu 11.10 x64, debugging problems [message #834717 is a reply to message #831930] Mon, 02 April 2012 09:51 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1964
Registered: July 2009
Senior Member
You should flush stdout.

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse CDT on Ubuntu 11.10 x64, debugging problems [message #835915 is a reply to message #834717] Tue, 03 April 2012 21:06 Go to previous messageGo to next message
Matteo Eit is currently offline Matteo Eit
Messages: 7
Registered: March 2012
Junior Member
Oh, my bad...Is it normal that I've to add after every printf a fflush(stdout)? I had experiences running gdb in terminal and I didn't need that, and I'm pretty sure that when I've used eclipse in past it wasn't needed...
Re: Eclipse CDT on Ubuntu 11.10 x64, debugging problems [message #836243 is a reply to message #835915] Wed, 04 April 2012 09:09 Go to previous message
Axel Mueller is currently offline Axel Mueller
Messages: 1964
Registered: July 2009
Senior Member
Matteo Eit wrote on Tue, 03 April 2012 23:06
Oh, my bad...Is it normal that I've to add after every printf a fflush(stdout)? I had experiences running gdb in terminal and I didn't need that, and I'm pretty sure that when I've used eclipse in past it wasn't needed...

Eclipse uses its own terminal. So you might get a different behavior. However, as you said I never encountered problems with the console in Eclipse under Linux (Windows is something different). But I guess your problems relates to using stdout and stdin.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:Project Compiled but binaries not created
Next Topic:How to get rid of old compilers "include paths not found" warnings?
Goto Forum:
  


Current Time: Fri Oct 24 23:19:29 GMT 2014

Powered by FUDForum. Page generated in 0.01647 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software