Use GSL library with Qt
Solved
General and Desktop
-
Hi,
I know this question was asked many times before, but I still have troubles in solving this issue.
what I have done so far:- i managed to successfully compile the library using MinGW according the procedure described in this link. As a result, I obtained "C:\gsl-2.6" with four folders in it: bin, include, lib and share. the bin folder contains libgsl-25.dll and libgslcblas-0.dll and lib folder contains: libgsl.a and libgslcblas.a. And the include contains gsl folder with the required headers of the library in it.
- I made a Qt Widget Application named gslTest and added to it
win32{ INCLUDEPATH += C:/gsl-2.6/include/ INCLUDEPATH += C:/gsl-2.6/lib LIBS += -LC:/gsl-2.6/lib -llibgsl -llibgslcblas -lm }
So far the project builds without any problem.
- finally, I tried to implement this example.
double x = 5.0; double y = gsl_sf_bessel_J0 (x);
When I add
#include <gsl/gsl_sf_bessel.h>
qt recognizes it but i get error message indouble y = gsl_sf_bessel_J0 (x);
gslTest\gslTest\mainwindow.cpp:11: error: undefined reference to `gsl_sf_bessel_J0'
I tried many ways to run this example and this the best I've got.
Please, any ideal about what is wrong here.
Thanks in advance. -
Hi,
The lib in -llibgsl shall be dropped (same for the other libraires.)
-
No, you should modify your .pro file.
Are you sure these libraries architecture matches the one from the Qt version you are using ?