PDA

View Full Version : Using a Win32 static library



jacky
14th April 2009, 14:26
I am newbie in Qt4 but have 10+ years experience in coding C++.

I have an application that is coded in MFC which uses a 3rd party Win32 static library. I would like to rebuild the application in QT4 but unfortunately I do not have the source code.

I would like to know if it is possible to use a Win32 static library in QT4. If not, let me know. If yes (what I hope for) please provide a simple example or a reference to a site which shows how to do this.

Many thanks in advance for your advice.

spud
14th April 2009, 14:43
To use sample.lib in the directory 3rdParty/lib All you have to do is add the following line to your .pro file:

LIBS += -L./3rdParty/lib -lsample
You could run into problems if the library links to another version of the MSVC runtime libraries than you are using. The compiler will warn you about that, though .

jacky
15th April 2009, 04:39
Thanks for your advice.

I added a LIBS line as your suggestion in the .pro file however the MINGW compiler says "Undefine reference to '<the lib method>'".

The lib is compiled by MC++ compiler then I think it may cause problems but I don't know if there is any ways to work around.

Many thanks in advance for your advice.