Results 1 to 9 of 9

Thread: statically linked executable

  1. #1
    Join Date
    Jan 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default statically linked executable

    hi all,
    i would like to know, what i have to do in order to get an exe-file, which i can run on a machine without Qt.
    as far as i know this is what is called "statically linked", isn't it?
    (i have only the free version of Qt)

    thanks for any suggestion
    smalls

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: statically linked executable

    yes it is
    in dymic linked mode you must have qt-mtblablabla.dll with your *.exe

  3. #3
    Join Date
    Jan 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: statically linked executable

    so which of the dll's do i have to redistribute with my app?
    (some of them are really big)
    where should they be placed?

    and is it possible, to link them statically, so that i needn't to have the dll's with the app?

  4. #4
    Join Date
    Jan 2006
    Location
    Athens - Greece
    Posts
    219
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: statically linked executable

    Quote Originally Posted by smalls
    so which of the dll's do i have to redistribute with my app?
    In most cases you'll need QtCore4.dll QtGui4.dll and your compiler's dll (mingwm10.dll for you know which compiler) but in order to get a definite answer you should see which modules you use in your app and include the neccessary dlls (eg if you're using xml you'll need QtXml4.dll if you're using OpenGl you'll need QtOpenGL4.dll etc).
    Quote Originally Posted by smalls
    where should they be placed?
    In your program's working dir, or in [WINDIR]/system32 with the later being a very bad choice leading to dll hell most of the times.
    Quote Originally Posted by smalls
    and is it possible, to link them statically, so that i needn't to have the dll's with the app?
    yes

  5. #5
    Join Date
    Jan 2006
    Location
    Frankfurt, Germany
    Posts
    34
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: statically linked executable

    what's up with linux? i'm building a live cd with a qt4-app and installed the qtlibs to do this (dynamically linked). I've read you need to recompile QT to get a static version. Is this really the only way if you're using linux?

  6. #6
    Join Date
    Jan 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: statically linked executable

    including the core libs boosts the size of my app....
    how do i link it statically?
    i guess this won't inflate the size that much, cause i think then only the parts are included which are really needed.... but maybe i am wrong.

    nevertheless, can someone tell me how to link it statically, such that i dont need the qt dlls on the target system?

  7. #7
    Join Date
    Jan 2006
    Location
    Saint-Petersburg (Russia)
    Posts
    41
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: statically linked executable

    Quote Originally Posted by smalls
    including the core libs boosts the size of my app....
    how do i link it statically?
    i guess this won't inflate the size that much, cause i think then only the parts are included which are really needed.... but maybe i am wrong.

    nevertheless, can someone tell me how to link it statically, such that i dont need the qt dlls on the target system?
    You need to compile staically your application with settings in compiler.
    I use MSVC.net so this options availible in the project settings
    Succes is 5% of talent and 95% of work!

  8. #8
    Join Date
    Jan 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: statically linked executable

    i've got only the standard compiler that comes with free Qt, (mingw or something like that).
    anyone know how to link statically in that case???

  9. #9
    Join Date
    Jan 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: statically linked executable

    well, finally i found some informations about how to link statically...
    http://doc.trolltech.com/qq/qq10-win...eployment.html
    i followed the instructions but i didn't include any additional libraries, so i wasn't wondering, that the exe still did not work on a machine without Qt. some dll was missing (and it was some mingw specific dll)... and the size of my app grow up to over 70 (seventy) MB. where as the dynamically linked version used to be about 1 (one) MB...
    so i will switch back to dynamically linking and i will found out which dll's to redistribute with my app, when i'm going to give it to somebody...

Similar Threads

  1. Qt3 qprocess, executable exited?
    By triperzonak in forum Newbie
    Replies: 2
    Last Post: 22nd September 2008, 11:21
  2. Application seems not to be linked statically
    By Boron in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd April 2008, 17:14
  3. Statically linked QtSql modules
    By runderwo in forum Qt Programming
    Replies: 5
    Last Post: 10th September 2007, 22:43
  4. Replies: 1
    Last Post: 18th April 2007, 20:48
  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, 08: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.