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 |
Henrik 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 #633517 is a reply to message #557831] |
Mon, 18 October 2010 10:15 |
unsown 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 #633947 is a reply to message #633724] |
Wed, 20 October 2010 01:16 |
unsown 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
|
|
|
| | | | | | | | |
Goto Forum:
Current Time: Fri Sep 20 02:43:22 GMT 2024
Powered by FUDForum. Page generated in 0.06110 seconds
|