Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problem with GSL in Eclipse(Console stys empty: Compiler shows no errors, but program is not running.)
Problem with GSL in Eclipse [message #491685] Thu, 15 October 2009 13:28 Go to next message
Henrik  is currently offline Henrik Friend
Messages: 1
Registered: October 2009
Junior Member
Hi everyboda,

so far I only worked with Visual C++ and, because I do not want to reinvent the wheel, wanted to change to eclipse and use the GNU Scientific library (GSL).
This endeavor know took me nearly two working days and I am still kind of stuck.
Step 1:
What did I do:
I installed cygwin with GSL
I installed Eclipse for C++
Result:
The "Hello World" example runs. I can compile it, run it, and get a working stand alone program with a Hello World output.

Step 2: Then I wanted to include gsl.
What did I do:
Wrote a small example programm to test gsl:
#include <iostream>
#include <gsl/gsl_statistics.h>
using namespace std;

int main() {

	cout << "!!!Hello World!!!" << endl; 

	double data[5] = {17.2, 18.1, 16.5, 18.3, 12.6};
	double mean;
	mean  = gsl_stats_mean(data, 1, 5);

	cout << mean << endl;

	return 0;
}


Because of receiving numerous errors, I searched the net for some time and finally did the following to include the gsl header (found here: http://www.eclipse.org/forums/index.php?t=msg&goto=23130 3&S=e12b33cc44ec8098c3abf3d5a3bc9056#msg_231303):
1) Added the gsl folder to to Project Properties -> C/C++ General -> Paths and Symbols -> Include for both GC and Gnu C and Gnu C++ languages
2) Added 'gsl' to Project Properties -> C/C++ Build -> Settings -> Tool Settings -> Cygwin C++ Linker -> Libraries -> Libraries
3) Added the gsl folder to Project Properties -> C/C++ Build -> Settings -> Tool Settings -> CygWin C++ Linker -> Libraries -> Library Search Path

Now, the error messages disappear and the compiler compiles. However, nothing happens. The console stays empty.
If I comment out the line using the gsl function, the program runs again.
I tried to donwload another version of gsl (GnuWin32), but the problem stays the same.

Does anybody has a hint of how to proceed? Do I include the files in the correct way?

Thanks a lot,
Henrik

Re: Problem with GSL in Eclipse [message #492853 is a reply to message #491685] Thu, 22 October 2009 05:43 Go to previous messageGo to next message
Henry Chan is currently offline Henry ChanFriend
Messages: 19
Registered: October 2009
Junior Member
Don't see anything obviously wrong.

At work, I used gsl on Linux with Eclipse. It works fine.

Try GDB instead of stdout.
Re: Problem with GSL in Eclipse [message #555811 is a reply to message #491685] Sun, 29 August 2010 01:11 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: August 2010
Junior Member
I am facing the same problem. Were you ever able to solve the problem?

Thanks,
Jake
Re: Problem with GSL in Eclipse [message #557802 is a reply to message #555811] Thu, 09 September 2010 02:42 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: September 2010
Junior Member
I have the same problem. When I run something as simple as the following, I see nothing in the console.
printf("Just a test");
But if I run it in debug I see the output in the console. I also get output when I run the compiled exe from the command line.

I'm not sure why I can't see the output when executing in the regular run mode.
Re: Problem with GSL in Eclipse [message #557831 is a reply to message #557802] Thu, 09 September 2010 07:00 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
This is a well known problem with the console output of Eclipse on Windows. There are two possible workarounds:
- add fflush() after every printf/scanf
- add the following command in your main routine
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

This will disable the console buffering.

I added this to the CDT FAQ


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google

[Updated on: Thu, 09 September 2010 07:07]

Report message to a moderator

Re: Problem with GSL in Eclipse [message #633517 is a reply to message #557831] Mon, 18 October 2010 10:15 Go to previous messageGo to next message
unsown  is currently offline unsown Friend
Messages: 3
Registered: October 2010
Junior Member
This method seems no use for the GSL case.
I don't understand why the console behaves differently when there is a function called in the main()?

Axel Mueller wrote on Thu, 09 September 2010 03:00
This is a well known problem with the console output of Eclipse on Windows. There are two possible workarounds:
- add fflush() after every printf/scanf
- add the following command in your main routine
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

This will disable the console buffering.

I added this to the CDT FAQ

[Updated on: Mon, 18 October 2010 12:30]

Report message to a moderator

Re: Problem with GSL in Eclipse [message #633724 is a reply to message #633517] Tue, 19 October 2010 06:44 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
unsown wrote on Mon, 18 October 2010 12:15
This method seems no use for the GSL case.
I don't understand why the console behaves differently when there is a function called in the main()?

Axel Mueller wrote on Thu, 09 September 2010 03:00
This is a well known problem with the console output of Eclipse on Windows. There are two possible workarounds:
- add fflush() after every printf/scanf
- add the following command in your main routine
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

This will disable the console buffering.

I added this to the CDT FAQ



Do you use Win64? See
http://www.eclipse.org/forums/index.php?t=msg&goto=62987 2&S=6ee034734ea8d59067ac5a5bdb3e7fef
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236330


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Problem with GSL in Eclipse [message #633947 is a reply to message #633724] Wed, 20 October 2010 01:16 Go to previous messageGo to next message
unsown  is currently offline unsown Friend
Messages: 3
Registered: October 2010
Junior Member
Thanks for the response.
I'm working on WinXP-32. Actually, I have no problem get the output from the code post here:
http://www.eclipse.org/forums/index.php?t=msg&goto=62987 2&S=6ee034734ea8d59067ac5a5bdb3e7fef

I found the issue is raised only when libraries libgsl-0.dll and libgslcblas-0.dll of GSL: are linked to the program, even if those are not called by any function at all.


Axel Mueller wrote on Tue, 19 October 2010 02:44
unsown wrote on Mon, 18 October 2010 12:15
This method seems no use for the GSL case.
I don't understand why the console behaves differently when there is a function called in the main()?

Axel Mueller wrote on Thu, 09 September 2010 03:00
This is a well known problem with the console output of Eclipse on Windows. There are two possible workarounds:
- add fflush() after every printf/scanf
- add the following command in your main routine
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

This will disable the console buffering.

I added this to the CDT FAQ



Do you use Win64? See
http://www.eclipse.org/forums/index.php?t=msg&goto=62987 2&S=6ee034734ea8d59067ac5a5bdb3e7fef
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236330

Re: Problem with GSL in Eclipse [message #634822 is a reply to message #491685] Sun, 24 October 2010 02:13 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: October 2010
Junior Member
Thank all of you for the help. I was having similar issue, but am muddling through.
Re: Problem with GSL in Eclipse [message #634828 is a reply to message #634822] Sun, 24 October 2010 05:28 Go to previous messageGo to next message
unsown  is currently offline unsown Friend
Messages: 3
Registered: October 2010
Junior Member
I can only manage to see the output of the codes by debugging them. Do you have a better solution. If it is so, would you please share it with me. Thanks.

No Real Name wrote on Sat, 23 October 2010 22:13
Thank all of you for the help. I was having similar issue, but am muddling through.

Re: Problem with GSL in Eclipse [message #634922 is a reply to message #634828] Mon, 25 October 2010 07:15 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Try one of the following

1) add "-static-libgcc" to the linker flags

2) Create your own console http://www.eclipse.org/forums/index.php?t=msg&S=2620f84e c9c38a20236019b83f51f763&th=168233&goto=547469#msg_5 47469

3) create a file gdbinit and insert the command "set new-console on" and use this gdbinit for your Debug Launch Config


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Problem with GSL in Eclipse [message #854047 is a reply to message #491685] Mon, 23 April 2012 15:55 Go to previous messageGo to next message
Eric Buchwald is currently offline Eric BuchwaldFriend
Messages: 1
Registered: April 2012
Junior Member
Okay, I had the same problem with compiling working and than running but without output, but now it's working.

Solution: Find the directory where cygblas-0.dll lies. At my computer this was C:\cygwin\lib\lapack. Add this directory to your pathvariable (just where you added C:\cygwin\bin as well).

So the mainproblem was, that eclipse was not able to find that dll, therefor compiling worked, but running didn't. Do not forget to restart Eclipse. If you're using makefiles don't write g++, but use g++-3 instead. And of course you have to add -lm -lgsl -lgslcblas as libraries.

Hope this will prove helpfull, for I was searching 2 days for this solution.
Re: Problem with GSL in Eclipse [message #856419 is a reply to message #854047] Wed, 25 April 2012 16:36 Go to previous messageGo to next message
Beau Webber is currently offline Beau WebberFriend
Messages: 6
Registered: April 2012
Junior Member
> Hi,
> I am a long-time c (scripting) and Altera hardware user, and have just
> come to the Eclipse installation that the latest version of Altera's
> NiosII download installs.

I have a number of problems even with the simple Hello World examples (no output from run, debugger does not launch, connection to fpga upload fails) that are possibly related to the fact I am working on a Windows 7 (64 bit) system.

I believe a fix for the above is given in the following forum item :
https: //bugs.eclipse.org/bugs/show_bug.cgi?id=236330

As I say, I am very new to IDEs and to Eclipse in particular - can anyone tell me what I do with the files I unpack from the org.eclipse.cdt.repo.zip file that this points to ?
cheers,
Beau Webber

Re: Problem with GSL in Eclipse [message #857092 is a reply to message #856419] Thu, 26 April 2012 08:31 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Beau Webber wrote on Wed, 25 April 2012 18:36

I believe a fix for the above is given in the following forum item :
https: //bugs.eclipse.org/bugs/show_bug.cgi?id=236330

As I say, I am very new to IDEs and to Eclipse in particular - can anyone tell me what I do with the files I unpack from the org.eclipse.cdt.repo.zip file that this points to ?
cheers,
Beau Webber

The fix is included in the latest release 8.0.1 Indigo. Just update your Eclipse installation.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Problem with GSL in Eclipse [message #857132 is a reply to message #857092] Thu, 26 April 2012 09:12 Go to previous messageGo to next message
HagenFriend
Messages: 90
Registered: April 2010
Member
> Beau Webber wrote on Wed, 25 April 2012 18:36
>> I believe a fix for the above is given in the following forum item :
>> https: //bugs.eclipse.org/bugs/show_bug.cgi?id=236330

On 4/26/2012 10:31 AM, Axel Mueller wrote:
> The fix is included in the latest release 8.0.1 Indigo. Just update your
> Eclipse installation.

Updating might not work. OP is trying to get a modified Eclipse
installation from Altera (for Nios II) to work on Win/64bit:

> On 4/26/2012 1:23 AM, Beau Webber wrote:
> Any suggestions how I can install a more recent (64bit compatible)
> version without losing all the Altera configuration info ?

If Altera does not provide a version for Win7/64bit,
you could install a 32bit Java Runtime on Win7/64bit
and use the Altera-provided Eclipse installation with this.

Make sure you start Altera's Eclipse installation
with the 32bit Java VM, and you should be fine.
Re: Problem with GSL in Eclipse [message #857706 is a reply to message #857132] Thu, 26 April 2012 19:47 Go to previous message
Beau Webber is currently offline Beau WebberFriend
Messages: 6
Registered: April 2012
Junior Member
Thanks indeed Alex.
I will try what you have suggested, thanks,
Previous Topic:Linking referenced project when building a static lib.
Next Topic:Eclipse Juno - CDT build project grayed out
Goto Forum:
  


Current Time: Thu Mar 28 18:02:10 GMT 2024

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

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

Back to the top