windows 如何使用 Qt-Creator 部署我的应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1947229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:59:38  来源:igfitidea点击:

How to deploy my application using Qt-Creator?

windowsqtdeploymentqt-creator

提问by Brian

I'm trying to deploy my simple Qt project like a hello world.

我正在尝试像 hello world 一样部署我的简单 Qt 项目。

I build it successfully and can also execute it on Qt-Creator. However, I can't execute the binary directly in the release folder due to some shared library errors.

我成功构建了它,也可以在 Qt-Creator 上执行它。但是,由于某些共享库错误,我无法直接在发布文件夹中执行二进制文件。

So I just copy some essential librarys to the release folder such as qtcore.dll and qtgui.dll, but I can't still execute it.

所以我只是把qtcore.dll、qtgui.dll等一些必要的库复制到release文件夹下,但是还是不能执行。

How can I deploy my simple Qt project? Is there an another step to deploy it?

如何部署我的简单 Qt 项目?是否还有其他步骤来部署它?

回答by Gregory Pakosz

You also need to deploy the MINGW runtime dll (mingwm10.dll). This file is located in your Qt\2009.5\mingw\bindirectory.

您还需要部署 MINGW 运行时 dll ( mingwm10.dll)。该文件位于您的Qt\2009.5\mingw\bin目录中。

Also pay attention to whether your application is compiled in debug mode or release mode. I just made the test with an hello world type application and Qt Creator. In the debugfolders, I copied libgcc_s_dw2-1.dll, mingwm10.dll, QtCored4.dlland QtGuid4.dlland it works.

还要注意您的应用程序是在调试模式还是发布模式下编译的。我刚刚使用 hello world 类型的应用程序和 Qt Creator 进行了测试。在debug文件夹中,我复制libgcc_s_dw2-1.dllmingwm10.dllQtCored4.dllQtGuid4.dll它的作品。

Pay attention to the din dll names, which stands for debug: QtCored4.dll.

注意din dll 名称,它代表 debug: 。QtCored4.dll

See Qt 4.6: Deploying an Application in Windows. For Qt 5, check this page.

请参阅Qt 4.6:在 Windows 中部署应用程序。对于 Qt 5,请查看此页面。

回答by Patrice Bernassola

If you don't want to have dependencies with qt/mingw dlls you should compile qt statically as explain here: http://qt.nokia.com/doc/4.6/deployment-windows.html#static-linking.

如果你不想依赖 qt/mingw dll,你应该静态编译 qt,如下解释:http: //qt.nokia.com/doc/4.6/deployment-windows.html#static-linking

回答by Jan Turoň

You may also use static linking, just add this line into the .profile:

您也可以使用静态链接,只需将此行添加到.pro文件中:

QMAKE_LFLAGS += -static-libgcc

QMAKE_LFLAGS += -static-libgcc

I found the solution hereand successfully tested on WinXP with QT creator 2.2.0

我在这里找到了解决方案并成功地在 WinXP 上使用 QT creator 2.2.0 进行了测试

回答by Will

Try running dependency walker on it (http://dependencywalker.com/) to see which dlls are missing?

尝试在其上运行 Dependency walker ( http://dependencywalker.com/) 以查看缺少哪些 dll?

Generally, you won't need to move those Qt libraries into your local folder since the Qt installation should've added those libraries into your path.

通常,您不需要将这些 Qt 库移动到您的本地文件夹中,因为 Qt 安装应该已将这些库添加到您的路径中。

One possibility is that you built debug, and the Qt debug dlls are named differently

一种可能性是您构建了调试,并且 Qt 调试 dll 的名称不同

回答by ali

copy all the qt dlls to your windows directory directly "C:\Windows\" and there will be no qt dll error 100% working and simple nb: do not create a qt dll folder in your windows directory post them as they are

将所有 qt dll 直接复制到您的 windows 目录“C:\Windows\”,并且不会出现 qt dll 错误 100% 工作且简单注意:不要在 windows 目录中创建 qt dll 文件夹,按原样张贴它们