如何在 Windows 上使用 QT Creator 编译独立程序? [英] How to compile a standalone with QT Creator on Windows?

查看:37
本文介绍了如何在 Windows 上使用 QT Creator 编译独立程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Qt Creator 创建了一个 Qt 应用程序.我想将独立的可执行文件发送给朋友,但他无法执行该文件.他的错误是他缺少很多 DLL.

如何编译真正独立的可执行文件?我的朋友不需要安装任何 dll 或框架来执行这个程序?

我正在使用编译器:MinGW 4.9(32 位)并且我有 QT 版本 5.4 或 5.5(我不确定).这是他的错误图片(遗憾的是它是德语,但我希望谷歌翻译能帮助你):

解决方案

虽然这不是一个合适的分发方式,但现在应该足够了.

将可执行文件(.exe 文件)复制到另一台 PC(或虚拟机),无需安装 Qt.如果您安装了 Qt,它会从 PATH 变量(例如,您的开发 PC)中找到一些库

一旦复制,请尝试运行直到成功.除非所有依赖项都得到满足,否则您将看到与您的朋友相同的错误对话框,该对话框将具有 dll 名称.复制所需的所有 dll 并压缩文件夹并将其发送.

大部分 dll 都可以在 \Qt Dir\mingw492_32\bin\Qt Dir\mingw492_32\plugins 中找到.>

希望这会有所帮助.

I created a Qt App with Qt Creator. I want to send the stand-alone executable to a friend, but he can't execute the file. His error was that he is missing a lot of DLLs.

How can I compile a truly standalone executable? One such that my friend doesn't have to install any dlls or frameworks to execute this program?

I'm using the compiler: MinGW 4.9 (32-bit) and I have the QT version 5.4 or 5.5 (I am not sure). Here is a picture of his error (sadly it is in German, but I hope the google translator will help you):

解决方案

Although this is not a proper distribution method, this should be enough for you now.

Copy the executable (.exe file) to another PC (or a virtual machine) without Qt installation. if you have Qt installed, it will find some libs from PATH variable (for ex, your dev PC)

Once copied, try to run that until you succeed. Until unless all the dependencies are satisfied, you will see the same error dialogue as your friend which will have dll name. Copy all the dlls required and zip the folder and send it across.

Most of the dlls are found in \Qt Dir\mingw492_32\bin and \Qt Dir\mingw492_32\plugins.

Hope this helps.

这篇关于如何在 Windows 上使用 QT Creator 编译独立程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆