运行不带Qt的.EXE [英] Run .EXE without Qt
问题描述
[解决方案]
[ Solution ]
我想在没有<$的机器上运行使用 QtSDK
创建的应用程序c $ c> Qt 安装。
I want to run my app created with QtSDK
on a machine that does not have Qt
installed.
我试图将
BIN
文件夹到我的项目的发布,但它没有工作。
I tried to copy the DLL's
from the BIN
folder to the release of my project, but it did not work.
- 我复制所有
dll的
文件夹d:\Qt\\ \\ Qt5.0.1\5.0.1\mingw47_32\bin
- 并将其粘贴到我的项目的文件夹中:
d :\projects\mybrowser\mybrowser-build-Desktop_Qt_5_0_1_MinGW_32bit-Release\lease
- 并将其发送到另一台计算机
Qt
- 在没有Qt 的计算机
中,我安装了
vcredist_sp1_x86.exe
并尝试运行我的应用程序
browsertest.exe
- I copy all
dll's
folderd:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin
- And pasted it in the folder of my project:
d:\projects\mybrowser\mybrowser-build-Desktop_Qt_5_0_1_MinGW_32bit-Release\release
- and send it to another computer
without Qt
- In computer
without Qt
, I installedvcredist_sp1_x86.exe
and tried to run my applicationbrowsertest.exe
microsoft visual c ++ runtime library:此应用程序请求
运行时以异常方式终止
microsoft visual c++ runtime library: this application has requested the runtime to terminate it in an unusual way
问:我真正想知道的:
如何在未安装Qt的其他计算机(Windows)上运行在Qt中构建的应用程序?
How do I run an application built in Qt on other computers (Windows) without Qt installed?
- Qt5.0.1 32位
- mingw 4.7 32位
- QtCreator 2.6.2
- Windows 7 64位。
- Intel i5
- Qt5.0.1 32bit
- mingw 4.7 32bit
- QtCreator 2.6.2
- Windows 7 64bit.
- Intel i5
:
Folders:
- D:\Qt\Qt5.0.1\5.0.1\mingw47_32
- D:\Qt\Qt5.0.1\Tools\MinGW
Qt / Mingw:
- D:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin\\ \\qmake.exe
- d:\Qt\Qt5.0.1\Tools\MinGW\bin\gcc.exe
文件 .pro :
QT += webkitwidgets network core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = browsertest
TEMPLATE = app
RC_FILE = browser.rc
SOURCES += main.cpp\
mybrowser.cpp
HEADERS += mybrowser.h
FORMS += mybrowser.ui
, 请告诉我。
grateful
If any information you missed, please let me know. grateful
推荐答案
要分发应用程序,您需要复制 DLLs DLL 必要)。
To distribute your application you need to copy the DLLs (only the DLLs necessary).
-
$ b
< DRIVE>:\Qt\Qt< Version_qt> \< Version_qt> \mingw< Version_mingw> \
或< DRIVE>:\ Qt \Qt< Version_qt> \< Version_qt> \mingw< Version_mingw> \bin\
例如: C:\Qt\Qt5.2.0\5.2.0\mingw48_32\
或 C:\Qt\Qt5.2.0\5.2.0\mingw48_32\bin
贴上
然后复制< DRIVE>:\ Qt \Qt< Version_qt> \< Version_qt> \mingw< Version_mingw> \plugins
例如: C:\ Qt\Qt5.2.0\5.2.0\mingw48_32\plugins
贴上
注意:在下面的示例必须从不同位置复制DLL,并移除调试DLL (仅用于在调试中编译)。
Note: In this example (below), it was necessary to copy DLLs from different places and remove the Debug DLLs (used only to compile in Debug).
请注意, debug dlls
以d.dll结尾,例如: Qt5Core.dll 和 Qt5Cored.dll 或 Qt5Concurrent.dll 和 Qt5Concurrentd.dll ,以d.dll结尾。
Note that the debug dlls
end with "d.dll", for example: Qt5Core.dll and Qt5Cored.dll or Qt5Concurrent.dll and Qt5Concurrentd.dll, the ending with "d.dll" should not be copied.
结构应该类似这样(示例):
The structure should look something like this (example):
- c:\project\ app.exe(您在 Qt 中创建的应用)
- c:\project\Qt5Core.dll( dll > qt / mingw 文件夹或 qt / mingw / bin )
- c:\project\platforms >从 qt / mingw / plugins 文件夹)
- c:\project\platforms\qminimal.dll( dll qt / mingw / plugins / platforms 文件夹)
- c:\project\app.exe (your app created in Qt)
- c:\project\Qt5Core.dll (dll from qt/mingw folder or qt/mingw/bin)
- c:\project\platforms (folder from qt/mingw/plugins folder)
- c:\project\platforms\qminimal.dll (dll from qt/mingw/plugins/platforms folder)
只有一些 DLL mingw ,因此我建议您使用 Dependency Walker 2.2
Only some DLLs the mingw will be needed, so I recommend using the Dependency Walker 2.2
结果应该看起来像这样(不是所有的dll都是需要的,这可能因项目类型而异):
The result should look like this (not all dlls are needed, this can vary by project type):
感谢:
-
+1为@MartinBeckett,显示我的程序找到 DLLs 必需。
+1 @WouterHuysentruit,由于我指出的应用程序,我发现 mingw \plugins 文件夹的内容应该直接进入应用程序文件夹。
+1 for @WouterHuysentruit, thanks to the application I indicated, I discovered that the contents of the mingw\plugins folder should go straight into the application folder.
@WouterHuysentruit我会认为你的答案是正确的,但你刚才说,所以我简单的解释。非常感谢。
@WouterHuysentruit I would consider your answer as correct, but you just said, so I put a simpler explanation. Thanks anyway.
这篇关于运行不带Qt的.EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!