User forums > General (but related to Code::Blocks)
Third-party libraries: adding GSL to CODE::blocks
humesit:
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.
--- Code: --- #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;
}
--- End code ---
--- Code: ---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
--- End code ---
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++. :?
digital19:
I had the same problem.
For me, I had to add 'libgsl.a' to the link libraries in "Linker Settings".
nenin:
--- Quote from: digital19 on November 04, 2008, 06:44:10 am ---I had the same problem.
For me, I had to add 'libgsl.a' to the link libraries in "Linker Settings".
--- End quote ---
For sure, you always must to add libgsl.a (and sometimes, libgslcblas.a) to "Link libraries:"
Navigation
[0] Message Index
[*] Previous page
Go to full version