Results 1 to 3 of 3

Thread: Using a Win32 static library

  1. #1
    Join Date
    Apr 2009
    Posts
    15
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Using a Win32 static library

    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.

  2. #2
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using a Win32 static library

    To use sample.lib in the directory 3rdParty/lib All you have to do is add the following line to your .pro file:
    Qt Code:
    1. LIBS += -L./3rdParty/lib -lsample
    To copy to clipboard, switch view to plain text mode 
    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 .

  3. #3
    Join Date
    Apr 2009
    Posts
    15
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using a Win32 static library

    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.

Similar Threads

  1. Extending a plugin in a static library
    By ultim8 in forum Qt Programming
    Replies: 5
    Last Post: 25th March 2010, 15:10
  2. Win32 static library
    By jacky in forum Newbie
    Replies: 1
    Last Post: 19th April 2009, 15:35
  3. Compiling QCA as static library
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 7th December 2008, 17:32
  4. Replies: 16
    Last Post: 23rd May 2008, 10:12
  5. Win32 qmake: building a static library
    By Amanda in forum Qt Programming
    Replies: 5
    Last Post: 8th November 2006, 19:32

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.