Linking GSL library to Qt App on Windows
-
Hi everyone,
I have been trying to link GSL library (https://www.gnu.org/software/gsl/doc/html/usage.html) to an application I am building in Qt (Qt 6 6.3.1).
I got the source files of GSL library preprad to be compiled for windows from https://github.com/BrianGladman/gsl and I tested the compiled libraries, They work fine on Visual Studio.
In Qt, the lines added to the .pro file to statically link the library are:
When I compile and build the app, I recevie an error of the type "undefined reference to". I understan this means there is something wrong with linking, though I am not sure how to debug any further, any suggestions.
I can share the library files if that is allowed
Thank you
-
@SGaist Thank you very much
I compiled the library using MinGW64 (MSYS 2 MinGW64, the typing
$ pacman mingw-w64-x86_64-gsl-2.7.1-1)I then got the header files and the .a files copied from msys2 to the folder of the app and linked them, still getting the same error. Any suggestions?
Thanks again
Your .pro file search the libraries in the sources not the build folder.
-
Hi everyone,
I have been trying to link GSL library (https://www.gnu.org/software/gsl/doc/html/usage.html) to an application I am building in Qt (Qt 6 6.3.1).
I got the source files of GSL library preprad to be compiled for windows from https://github.com/BrianGladman/gsl and I tested the compiled libraries, They work fine on Visual Studio.
In Qt, the lines added to the .pro file to statically link the library are:
When I compile and build the app, I recevie an error of the type "undefined reference to". I understan this means there is something wrong with linking, though I am not sure how to debug any further, any suggestions.
I can share the library files if that is allowed
Thank you
Hi and welcome to devnet,
Based on what you wrote, you seem to be trying to use a library built with visual studio while building your application with MinGW. If so, this can't work. You can't mix and match compilers when using C++ libraries.
-
Hi and welcome to devnet,
Based on what you wrote, you seem to be trying to use a library built with visual studio while building your application with MinGW. If so, this can't work. You can't mix and match compilers when using C++ libraries.
@SGaist Thank you very much
I compiled the library using MinGW64 (MSYS 2 MinGW64, the typing
$ pacman mingw-w64-x86_64-gsl-2.7.1-1)I then got the header files and the .a files copied from msys2 to the folder of the app and linked them, still getting the same error. Any suggestions?
Thanks again
-
@SGaist Thank you very much
I compiled the library using MinGW64 (MSYS 2 MinGW64, the typing
$ pacman mingw-w64-x86_64-gsl-2.7.1-1)I then got the header files and the .a files copied from msys2 to the folder of the app and linked them, still getting the same error. Any suggestions?
Thanks again
Your .pro file search the libraries in the sources not the build folder.
-
@SGaist Thank you very much! It works perfectly now
-
-
@SGaist Thank you very much! It works perfectly now
@YoungCaveMan , can you tell, how build and use gsl in qt, step by step?