PDA

View Full Version : Problems linking gsl 2.1



avillaj88
30th June 2017, 20:17
I'm using Qt 5.8 and gsl 2.1 (compiled with cygwin64), this is what i use in the .pro file to link gsl:

INCLUDEPATH+=C:/gsl/include/
INCLUDEPATH += C:/gsl/LIBS
LIBS += -LC:/gsl/lib -lgsl -lgslcblas -lm

when i include the headers and compile i don't have any problem even when i declare and object, but when i tray to use any function i got this error:

C:\Users\CIFAS-1\untitled4\mainwindow.cpp:9: error: undefined reference to `gsl_matrix_alloc'.

Please any one has some idea?

Shark
30th June 2017, 21:02
Have you tried putting an environment extern "C" around the function declarations in your gsl header file?


extern "C" {
...
gsl_matrix_alloc();
...
}


It's only a guess. I just saw that in gsl_matrix_double.h from the GSL source, this actually should already be declared in C++.

d_stranz
30th June 2017, 21:31
compiled with cygwin64

And is your app also built with the gcc compiler from your cygwin distro? From the error message, this looks like a Visual Studio linker error. The two compilers are incompatible - you must build all binaries with either one or the other, can't mix and match.

avillaj88
17th July 2017, 18:48
No my app was built with the mingw compiler from Qt (the deafult compiler) in windows