1

I am working with C++ for a project and using the Qt framework to help me out. However, I am dealing with some annoying issues and I hope someone can help me out here. Here's what I have so far"

  • I created my C++ application using Qt
  • Compiled my application and send out the final .exe file

I also installed a separate non-developmental OS to test my application. On the test OS I just had to install the Qt libraries and my application would run just fine.

But some of the users of my application are having trouble running the application. Some of them installed Qt but the application still cannot find the required .dll files or if they installed Qt fine the application still fails because Qt itself has some other dependency. Or they are on a 64 bit but my application is 32-bit... so their 64 bit Qt library does not work with my application.

So, what I am thinking of doing is basically get a tree of all the .dll files my application will need to run smoothly and include all of them as part of my .exe application.

Certainly the file size will increase but at least I will have the peace of mind knowing that the application has everything it needs.

I am reading more about Static/Dynamic Linking etc... but in the C++ world it is a bit different. Is there a system in C++ that is similar to Java where you specify the libraries and during compilation C++ would copy the necessary libraries to the end product?

4

2 回答 2

0

依赖walker将向您显示您需要传递它们的所有需要​​的DLL

人们通常为此使用打包程序,您还可以使用它设置环境变量并摆弄注册表

于 2013-11-07T20:20:49.597 回答
0

您应该将 Qt DLL 放在可执行文件的发布版本中。这些是 QtCore4.dll、QtGui4.dll(Qt5Core.dll、Qt5Gui.dll、... 用于 Qt5)以及可能用于您使用的其他模块的那些。这些 dll 文件位于您安装的 Qt 目录中的 bin 文件夹中。

如果您使用的是 MSVS2010,您还应该放置 msvcr100.dll 和 msvcp100.dll。

如果你正在使用插件,你应该将它们的 dll 放在你 exe 旁边一个名为“plugins”的文件夹中。如果使用图标和图像,您应该在名为“imageformats”的文件夹中发送它们的 dll,例如 qico4.dll 和 qsvg4.dll(Qt5 的 qico.dll 和 qsvg.dll)。

于 2014-06-15T09:45:39.273 回答