Results 1 to 5 of 5

Thread: Create a DLL with a static build of Qt 4.3

  1. #1
    ucomesdag Guest

    Question Create a DLL with a static build of Qt 4.3

    All compilles and runs fine. But when compilling with a static version of Qt the program exits when calling the dll.

    Modified the .pro file:
    CONFIG += staticlib static qt thread

    But this doesn't ouput a dll. I know that "dll" produces a shared library.
    What I want is an executable with no dependencies except from the .dll.
    Last edited by ucomesdag; 5th May 2008 at 13:47.

  2. #2
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Create a DLL with a static build of Qt 4.3

    If you want to output a dll then you'll need to use 'dll' instead of 'staticlib'. staticlib will output a .lib file instead of a dll that can be statically linked into another exe / dll.

    All compilles and runs fine. But when compilling with a static version of Qt the program exits when calling the dll.
    How are you building your main exe, can you show us the .pro file?

  3. #3
    ucomesdag Guest

    Default Re: Create a DLL with a static build of Qt 4.3

    lib.pro
    Qt Code:
    1. TEMPLATE = lib
    2. #VERSION = 0.1.0
    3. CONFIG += staticlib static dll qt thread
    4.  
    5. CONFIG += debug_and_release
    6. CONFIG(debug, debug|release) {
    7. TARGET = "testdll"
    8. DESTDIR = ../../debug
    9. OBJECTS_DIR += ../../debug/tmp
    10. MOC_DIR += ../../debug/tmp
    11. UI_DIR += ../../debug/tmp
    12. }
    13. else {
    14. TARGET = "testdll"
    15. DESTDIR = ../../release
    16. OBJECTS_DIR += ../../release/tmp
    17. MOC_DIR += ../../release/tmp
    18. UI_DIR += ../../release/tmp
    19. }
    20.  
    21. # DEFINES only needed for windows
    22. win32 {
    23. CONFIG(dll) {
    24. DEFINES += BUILD_DLL
    25. }
    26. }
    27.  
    28. # Input
    29. HEADERS += qtestdll.h
    30. SOURCES += qtestdll.cpp
    To copy to clipboard, switch view to plain text mode 
    app.pro
    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += static
    3.  
    4. CONFIG += debug_and_release
    5. CONFIG(debug, debug|release) {
    6. TARGET = "test"
    7. DESTDIR = ../../debug
    8. OBJECTS_DIR += ../../debug/tmp
    9. MOC_DIR += ../../debug/tmp
    10. UI_DIR += ../../debug/tmp
    11. }
    12. else {
    13. TARGET = "test"
    14. DESTDIR = ../../release
    15. OBJECTS_DIR += ../../release/tmp
    16. MOC_DIR += ../../release/tmp
    17. UI_DIR += ../../release/tmp
    18. }
    19.  
    20. QT += core gui
    21.  
    22. SOURCES += main.cpp
    23. RESOURCES +=
    To copy to clipboard, switch view to plain text mode 

  4. #4
    ucomesdag Guest

    Default Re: Create a DLL with a static build of Qt 4.3

    For those interested in the code:
    Attached Files Attached Files

  5. #5
    ucomesdag Guest

    Default Re: Create a DLL with a static build of Qt 4.3

    All applications created with a static library will be at least 1.5MB in size and it is not possible to build or use any components or plugins with a static Qt library.
    http://trolltech.com/developer/knowledgebase/21/

    Guess that answers my question except if there is an other way

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

    Nightfox (23rd September 2012)

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 10:12
  2. Please Help-->have few doubts with Static build in Windows !
    By Krish in forum Installation and Deployment
    Replies: 1
    Last Post: 17th March 2008, 14:37
  3. Windows XP Qt 4.3.2 Static build
    By maxpower in forum Installation and Deployment
    Replies: 9
    Last Post: 2nd November 2007, 04:49
  4. Qt4 MacOSX UB Xcode and a static Qt build?
    By kuroyume0161 in forum Installation and Deployment
    Replies: 15
    Last Post: 18th March 2007, 08:10
  5. problem after Qt 4.2.2 static build
    By npc in forum Newbie
    Replies: 2
    Last Post: 23rd February 2007, 12:28

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.