简体   繁体   English

Qt C++ Windows 中的独立可执行文件

[英]Qt C++ Stand alone executable in Windows

I want to make my Qt C++ program a stand alone single application.我想让我的 Qt C++ 程序成为一个独立的单一应用程序。 By the way, I am using Qt creator 2.2.1 which is based on Qt 4.7.4.顺便说一句,我使用的是基于 Qt 4.7.4 的 Qt creator 2.2.1。 I followed the instructions from http://www.formortals.com/how-to-statically-link-qt-4/ to statically link the libraries.我按照http://www.formortals.com/how-to-statically-link-qt-4/的说明静态链接库。 I did not know where to find the configure.exe in the QtSDK folder so I downloaded "qt-everywhere-opensource-src-4.7.3" and followed the instructions.我不知道在 QtSDK 文件夹中哪里可以找到 configure.exe,所以我下载了“qt-everywhere-opensource-src-4.7.3”并按照说明进行操作。

I was unsure in Step 4 because the windows Qt options do not look similar.我在第 4 步中不确定,因为 windows Qt 选项看起来不相似。 Its not a path to a folder but rather a path to qmake location and I am not sure what to choose for that option.它不是文件夹的路径,而是 qmake 位置的路径,我不确定为该选项选择什么。

If anyone knows how to create the program as a stand alone without needing any dlls and can help me out, I would really appreciate it.如果有人知道如何在不需要任何 dll 的情况下独立创建程序并且可以帮助我,我将不胜感激。

Thanks谢谢

Regarding the step 4 you mentioned, in QtCreator you need to point the qmake executable you will find it in the build tree (where you built Qt statically) in the bin folder.关于您提到的第 4 步,在QtCreator中,您需要指向qmake可执行文件,您将在bin文件夹中的构建树(您在其中静态构建 Qt)中找到它。

I guess if you have problems on step 4 you should have built the static version of Qt , you've done 95% of the work !我想如果您在第 4 步遇到问题,您应该构建 Qt 的Qt版本,您已经完成了 95% 的工作!

The moment QtCreator will accept the qmake you made , you will just have to select this version use any wizard to get you first app, then add CONFIG += static to you .pro file.QtCreator接受你制作qmake时,你只需要 select 这个版本使用任何向导来获取你的第一个应用程序,然后将CONFIG += static添加到你的.pro文件中。

Here some Qt tutorial just in case.这里有一些 Qt 教程以防万一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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