PDA

View Full Version : Problem linking against library



PowerPlate
14th October 2011, 01:48
I've got big problems to link against following library: http://www.surina.net/soundtouch/

I managed to compile a .lib which works with Visual Studio Express 2010.
But I just don't get it to run with Qt.

Please help, I lost practically this whole day, trying to get this dam lib working :-/

ChrisW67
14th October 2011, 06:05
Please help, I lost practically this whole day, trying to get this dam lib working :-/
Yet you expect us to spend the whole day guessing what the actual problem might be.

PowerPlate
14th October 2011, 14:49
Well, it would have been a useful information, that a MSVC compiled library sometimes just cannot work with Qt's Mingw.
So I compiled it now with MSYS (after fixing a totally messed up installation) and recieved a half-working library.

Now I have:
soundtouch.a
soundtouch.la
pkgconfig/soundtouch.pc

What do I have to do with them?
I tried to link with "LIBS += -lsoundtouch" which let me compile my project and run it, BUT if I want to debug, it crashes right away with "gdb exited unexpectedly (code 1)"

Do I have to place the above files at a certain location? I don't know what to do with the .la and the .pc file.

ChrisW67
15th October 2011, 03:45
Well, it would have been a useful information, that a MSVC compiled library sometimes just cannot work with Qt's Mingw.
Yes, it would have been useful information that you were trying to use a library built with MSVC in a project using MingW. Qt is not a compiler and works equally well with Microsoft, GNU, and other compilers. Unfortunately you didn't provide that information, or any other error/warning/diagnostic information, which was my point. We might have guessed binary incompatibility, or that you had no idea how to link a 3rd party library into an program, or that the library was dynamically linked and not being found at run time, ...

So I compiled it now with MSYS (after fixing a totally messed up installation) and recieved a half-working library.

Now I have:
soundtouch.a
soundtouch.la
pkgconfig/soundtouch.pc

What do I have to do with them?

Link your application to the soundtouch.a file.

I tried to link with "LIBS += -lsoundtouch" which let me compile my project and run it,
Good so you have your linker library search path set correctly for soundtouch.a to be found.

BUT if I want to debug, it crashes right away with "gdb exited unexpectedly (code 1)"
Not enough information. Gdb crashes? Your program crashes and gdb reports it? Is a backtrace produced? Any other (error) output? Can you produce a minimal, complete program that reproduces the behaviour? Is the compiler version in your MSYS installation the same compiler, or the same version, as the one you are building your application with?


Do I have to place the above files at a certain location? I don't know what to do with the .la and the .pc file.
No. The library is statically linked into your application executable and a copy is not needed on the target machine. The other two files are information files for other utilities (libtools and pkgconfig) that can be used to configure projects that need to find the library.