Results 1 to 2 of 2

Thread: Using shared for debugging and static for deployment

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Using shared for debugging and static for deployment

    I am using Qt 4.5.1, WinXP and Visual Studio 2008.

    As far as I understand, the best way of working is to use Qt shared libraries while debugging and development, and linking statically for deployment.

    Questions:
    1)
    Does this require two separate Qt installations, or can Qt shared debug and Qt static release co-exist in the same Qt directory? If they can co-exist in the same Qt directory, what preparations are necessary (such as nmake distclean or nmake clean etc.) before the second installation?

    2)
    Is it possible to have a .vcproj project where the debug configuration is using shared libraries and the release configuration is using static link? if the answer is yes, how should this be done?
    MacOSX user dabbling with Linux and Windows.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using shared for debugging and static for deployment

    Quote Originally Posted by bnilsson View Post
    1)
    Does this require two separate Qt installations, or can Qt shared debug and Qt static release co-exist in the same Qt directory?
    They should be in different directories.

    If they can co-exist in the same Qt directory, what preparations are necessary (such as nmake distclean or nmake clean etc.) before the second installation?
    You'd have to compile one of them with some library prefix or suffix so that library names do not clash (i.e. have "QtCore" and "QtCore_static" libraries) and adjust specs accordingly.

    2)
    Is it possible to have a .vcproj project where the debug configuration is using shared libraries and the release configuration is using static link? if the answer is yes, how should this be done?
    Sure.
    qmake Code:
    1. CONFIG(debug, debug|release) {
    2. LIBS += -lsomelib
    3. }
    4. CONFIG(release, debug|release){
    5. CONFIG += static
    6. # static build may require changing some of the compiler flags, i.e. for MSVC
    7. ...
    8. LIBS += somelib.a
    9. # etc.
    10. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. shared vs static
    By alisami in forum Installation and Deployment
    Replies: 3
    Last Post: 4th October 2008, 13:04
  2. Replies: 16
    Last Post: 23rd May 2008, 10:12
  3. STATIC vs. SHARED
    By KaptainKarl in forum Installation and Deployment
    Replies: 1
    Last Post: 27th August 2007, 16:31
  4. Replies: 5
    Last Post: 18th April 2007, 20:02
  5. shared versus static build
    By jcr in forum Installation and Deployment
    Replies: 2
    Last Post: 28th January 2006, 08:05

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.