Results 1 to 6 of 6

Thread: Win32 qmake: building a static library

  1. #1
    Join Date
    Oct 2006
    Location
    San Francisco, USA
    Posts
    14
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Win32 qmake: building a static library

    Hi,

    Another question... (I'm new to Qt and qmake). I have the following .pro file (listed below), and I'm using qmake to generate a makefile. I want to build a Win32 static library (with MinGW) (e.g. <name>.lib) but I get a Unix library built (e.g. lib<name>.a).

    The relevant environment variables are:
    QMAKESPEC=win32-g++
    QTDIR=C:\Qt\4.2.1

    and MinGW and Qt are both in my PATH.

    Any ideas?

    Thanks,
    Amanda


    TEMPLATE = lib
    TARGET = tktabwidget
    DESTDIR = ..

    CONFIG += qt warn_on thread dll staticlib debug
    CONFIG -= release
    #CONFIG += qt warn_on thread staticlib release

    win32{
    CONFIG -= flat
    }

    debug{
    UI_DIR=.debug/ui
    MOC_DIR=.debug/moc
    OBJECTS_DIR=.debug/obj
    }

    release{
    UI_DIR=.release/ui
    MOC_DIR=.release/moc
    OBJECTS_DIR=.release/obj
    }

    INCLUDEPATH += .\
    ../tkdock

    SOURCES += \
    tktabbar.cpp \
    tktabwidget.cpp

    HEADERS += \
    tktabbar.h \
    tktabwidget.h

    QT += qt3support
    QT += xml

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Win32 qmake: building a static library

    Quote Originally Posted by Amanda View Post
    but I get a Unix library built (e.g. lib<name>.a).
    That's how MinGW names libraries. If you want .lib file, try this: http://www.mingw.org/mingwfaq.shtml#faq-msvcdll

  3. The following user says thank you to jacek for this useful post:

    Amanda (10th November 2006)

  4. #3
    Join Date
    Oct 2006
    Location
    San Francisco, USA
    Posts
    14
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Win32 qmake: building a static library

    Thank you for your reply. However, msvcdll builds a dll for Microsoft Visual C++. I don't want to build a dynamic library, I'm building a static library. Also, I'm using Eclipse with MinGW not Microsoft Visual C++.

    I thought lib<name>.a is the naming convention for a static library on Unix. Therefore, I assumed I am not building my library correctly on a Win32 platform - is that assumption correct?

    Thanks,
    Amanda

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Win32 qmake: building a static library

    Quote Originally Posted by Amanda View Post
    I thought lib<name>.a is the naming convention for a static library on Unix.
    Yes, it is, but MinGW uses the same naming scheme for import libraries too.

  6. The following user says thank you to jacek for this useful post:

    Amanda (10th November 2006)

  7. #5
    Join Date
    Oct 2006
    Location
    San Francisco, USA
    Posts
    14
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Win32 qmake: building a static library

    So the build was successful, and I can just rename lib<name>.a to <name>.lib?

    Amanda

  8. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Win32 qmake: building a static library

    Quote Originally Posted by Amanda View Post
    So the build was successful, and I can just rename lib<name>.a to <name>.lib?
    If you want to use that library in MinGW, you don't have to do anything, and if you want to use it in a program compiled with MSVC, you shouldn't, since MinGW isn't binary compatible with MSVC and it just won't work.

  9. The following 2 users say thank you to jacek for this useful post:

    Amanda (10th November 2006), jacky (15th April 2009)

Similar Threads

  1. Generating a static and dynamic library
    By elcuco in forum Qt Programming
    Replies: 3
    Last Post: 20th August 2011, 12:46
  2. Wrap a static QT library inside an XPCOM component ?
    By Paul_Xul in forum Qt Programming
    Replies: 2
    Last Post: 3rd August 2010, 08:16
  3. Replies: 4
    Last Post: 8th April 2010, 00:09
  4. Building a third party library
    By munna in forum General Programming
    Replies: 1
    Last Post: 6th October 2006, 21:43
  5. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 09:52

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.