PDA

View Full Version : statically linked executable



smalls
7th February 2006, 17:34
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

zlatko
7th February 2006, 17:46
yes it is:)
in dymic linked mode you must have qt-mtblablabla.dll with your *.exe

smalls
7th February 2006, 18:10
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?

yop
7th February 2006, 20:50
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).

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.

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

kiker99
7th February 2006, 21:05
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?

smalls
9th February 2006, 01:21
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?

blackliteon
9th February 2006, 08:25
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

smalls
9th February 2006, 21:01
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???

smalls
11th February 2006, 03:09
well, finally i found some informations about how to link statically...
http://doc.trolltech.com/qq/qq10-windows-deployment.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...