Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » cdt running error(eclipse cdt won't run my c++ project)
cdt running error [message #641730] Sat, 27 November 2010 09:48 Go to next message
Hannes Vandecasteele is currently offline Hannes VandecasteeleFriend
Messages: 22
Registered: March 2010
Junior Member
Hi all,

I made som simple test program in eclipse cdt and compiled it. That works fine. code:

#include <iostream>


int main( ) {
	std::cout<<"";
	std::cout<<"print this.";
	return 0;
}


If i want to run the program, it doesn't print out anything. But, if i run it from the cmd or in netbeans, it all works fine. Also, when i want to debug the project, it doesn't work either, but it does in netbeans( error: "No source available for "main() at 0x4013d7" ")

Any ideas to fix this?

hannesvdc
Re: cdt running error [message #641902 is a reply to message #641730] Mon, 29 November 2010 08:30 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
If i want to run the program, it doesn't print out anything.

I guess you are working on Windows. There is a known problem with the console output. See
http://wiki.eclipse.org/CDT/User/FAQ#Eclipse_console_does_no t_show_output_on_Windows

Quote:
error: "No source available for "main() at 0x4013d7"

Did you build with debug info enabled?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: cdt running error [message #642036 is a reply to message #641730] Mon, 29 November 2010 15:52 Go to previous messageGo to next message
Hannes Vandecasteele is currently offline Hannes VandecasteeleFriend
Messages: 22
Registered: March 2010
Junior Member
Thanks for replly!

I added the following lines to my code:
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);


But i got the following errors:
../main.cpp:11:10: error: 'stdout' was not declared in this scope
../main.cpp:11:24: error: '_IONBF' was not declared in this scope
../main.cpp:11:33: error: 'setvbuf' was not declared in this scope
../main.cpp:12:10: error: 'stderr' was not declared in this scope


For debugging, what is 'build debug info enabled'?

hannesvdc
Re: cdt running error [message #642162 is a reply to message #642036] Tue, 30 November 2010 08:08 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Hannes Vandecasteele wrote on Mon, 29 November 2010 16:52
Thanks for replly!

I added the following lines to my code:
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);


But i got the following errors:
../main.cpp:11:10: error: 'stdout' was not declared in this scope
../main.cpp:11:24: error: '_IONBF' was not declared in this scope
../main.cpp:11:33: error: 'setvbuf' was not declared in this scope
../main.cpp:12:10: error: 'stderr' was not declared in this scope


For debugging, what is 'build debug info enabled'?

hannesvdc

You need #include <stdio.h> for setvbuf

Did you build a Debug or Release version?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: cdt running error [message #642284 is a reply to message #641730] Tue, 30 November 2010 16:56 Go to previous message
Hannes Vandecasteele is currently offline Hannes VandecasteeleFriend
Messages: 22
Registered: March 2010
Junior Member
It still doesn't work, this is my code:
#include <iostream>
#include <stdio.h>

int main( ) {
	setvbuf(stdout, NULL, _IONBF, 0);
	setvbuf(stderr, NULL, _IONBF, 0);
	std::cout<<"";
	std::cout<<"print this.";
	return 0;
}


Currently, debug is the active configuration.

hannesvdc
Previous Topic:Organizing code by refactoring classes into sub folders
Next Topic:0x0-Window when debugging
Goto Forum:
  


Current Time: Sat Dec 20 08:15:41 GMT 2014

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

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