hello
i´m a student and quite new to c++, but worked with other languages. i use winXP and codeblocks 8.02...
my problem is, that i want to use the gsl (GNU scientific libaryhttp://www.gnu.org/software/gsl/ (http://www.gnu.org/software/gsl/)) in my program.
how do i install it? i read the advices for other third party libarys in the wiki. not enough explanation for me...:-(
i downloaded the compressed file, what next? i tried to include the .c files by myself but that didn´t work.
(like that:)
#include <stdio.h>
#include <gsl/specfunc/gsl_sf_bessel.h> //i told the compiler to search for it, with "search directorys"
int
main (void)
{
double x = 5.0;
double y = gsl_sf_bessel_J0 (x);
printf ("J0(%g) = %.18e\n", x, y);
return 0;
}
error::
mingw32-g++.exe: no input files
thanks for every help!
best
chris
Few tips:
1) To build dll of GSL, add -mno-undefined to LDFLAGS while compiling. Correct sequence of commands can be-
./configure --enable-shared --prefix=/mingw
make LDFLAGS=-mno-undefined
2) If possible use cross-compiler to build GSL. From my experience, compiling GSL under MSYS is 2-3 times slower than a cross-compilation.
ok i just downloaded the pre-compiled libraries 1.8 version from sourceforge! thanks for that.
i added the \include directory to the searchdirectory of my compiler under "compiler and debugger"
but no he can´t find the functions that are declared in these .h files there.
this is a simply example for the use of gsl, copied from the documentation.
#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>
int
main (void)
{
double x = 5.0;
double y = gsl_sf_bessel_J0(x);
printf ("J0(%g) = %.18e\n", x, y);
return 0;
}
buid message:
obj\Debug\main.o||In function `main':|
C:\test\besseltest2\main.cpp|8|undefined reference to `_gsl_sf_bessel_J0'|
||=== Build finished: 1 errors, 0 warnings ===|
build log:
mingw32-g++.exe -Wall -fexceptions -g -IC:\Programme\GnuWin32\include -c C:\test\besseltest2\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\Programme\GnuWin32\include -o bin\Debug\besseltest2.exe obj\Debug\main.o
obj\Debug\main.o: In function `main':
C:/test/besseltest2/main.cpp:8: undefined reference to `_gsl_sf_bessel_J0'
collect2: ld returned 1 exit status
thanks for all the help. i´m a german student, currently studying in china near shanghai.
there is no help from the students/profs here and it certainly wasn`t my idea to use C++. :?