C++ – Decrease Qt GUI application size

cdllqtstatic-libraries

I'm learning to develop apps using Qt Creator. I have built a simple app under Windows, depends on uses mingwm10.dll, QtCore4.dll, QtGui4.dll, QtNetwork4.dll.
Out of QtQui4.dll I use only a a couple of widgets, and don't need all of the rest… Is it possible to either shrink the size of QtGui4.dll or do something else to decrease deployment size of application?
How about static linking? Will it embed the whole dll, or only parts of it that are used?
And also is it possible with Qt to link some dlls staticly and some dynamicly?

Best Answer

It's not possible to shrink the QtGui4.dll by removing some functions. Trolltech is having a look at this, but the good solution seems quite distant:

Static linking, I think it is very problematic on windows. Each time I tried, it was a nightmare.

So, it looks like you are stuck with the regular DLL. The only thing you can do (which I do for my Qt apps is):

  • use UPX to compress your DLL

or

  • use strong compression in your installer

If you already UPX your dll, you can not reduce it further with the installer compression, but this can reduce other files.