简体   繁体   中英

170 MB Hello World -> Deploying apps with Qt

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

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)

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

如果您计划部署Qt应用程序的静态链接版本,则应考虑构建库的自定义版本,以禁用所有不需要的功能 ,从而最大限度地减小库的大小。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM