views:

388

answers:

3

I'm new to Qt but no problem in the C++. I used Qt Creator and made a simple program with a button (like a hello world) then I built the project. I was not able to run the executable file in windows itself (outside the creator) because it needed these DLL files:

libgcc_s_dw2-1.dll
mingwm10.dll
QtGuid4.dll
QtCored4.dll

I found these files and put them beside the exe. Now the program works but the folder has a size of 170 MB because of the big Dll files. Is this a way of deploying Qt applications. I know their's a way to make a standalone static app but that's not the problem. I'm ok with the dlls but the dependencies seem to be too big. Is there a different method of deploying projects with smaller file sizes?

Thanks

+2  A: 

you have two problems here:

  • "procedure entry point not found": you have multiple versions of Qt libraries installed. Not good. You are linking against import library A, while at runtime your executable finds a dll B, which is not the one you linked against. Check your project output while linking to see which import library VS uses. Easiest solution: delete/uninstall everything Qt related and start over cleanly. Adjust your project settings likewise.
  • not finding the dlls at runtime: solution is to add the directory with qt dlls to your PATH
stijn
@stijn: That doesn't help the distribution problem though when the DLLs themselves are 170 MB.
Billy ONeal
I know that; other people already pointed out that was because of the debug build, so I didn't repeat that information..
stijn
+1  A: 

If you plan to deploy statically linked version of a Qt application, you should consider building custom versions of the libraries where you disable all the features you don't need, thus minimizing the size of the libraries.

teukkam
Statically linking requires a proper commercial Qt license FWIW.
Rob
@Rob: Qt is available under the LGPL, you don't need a commercial license to statically link with it as long as your application is LGPL as well. However there are lots of other issues as stated here: http://doc.qt.nokia.com/4.6/deployment.html
Adam W
+10  A: 

Why don't you do a release build and use the release dlls instead of the debug dlls which are much larger.

Since this is regarding size:

Debug libraries

QtCored4.dll = ~37MB

QtGui4d.dll = ~157MB

Release libraries

QtCore.dll = ~2.3Mb

QtGui4.dll = ~9MB

(from looking at the sizes in my Qt\version\bin directory)

radix07
Didn't catch this being mentioned in the comments to the original post before I posted this. But it is a valid answer to the question so I believe it should go here...
radix07