Run .EXE without Qt

[ Solution ]

I want to run my application created using QtSDK on a computer that does not have Qt installed.

I tried to copy the DLL's from the BIN folder to the release of my project, but this did not work.

I tried the following:

  • I will copy the DLL's d:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin
  • And pasted it into my project folder: d:\projects\mybrowser\mybrowser-build-Desktop_Qt_5_0_1_MinGW_32bit-Release\release
  • and send it to another computer without Qt
  • On a computer without Qt I installed vcredist_sp1_x86.exe and tried to run the browsertest.exe application

The following error has occurred:

Microsoft Visual C ++ Runtime Library: This application requested runtime to end it in an unusual way.

Q: What I really want to know:

How to run the application embedded in Qt on other computers (Windows) without installing Qt?

Details:

  • 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 file:

 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 

If any information you missed, let me know. grateful

+6
source share
3 answers

To distribute your application you need to copy the DLL (only the DLL is required).

  • Copy the DLLs needed from <DRIVE>:\Qt\Qt<Version_qt>\<Version_qt>\mingw<Version_mingw>\ or <DRIVE>:\Qt\Qt<Version_qt>\<Version_qt>\mingw<Version_mingw>\bin\

    for example: C:\Qt\Qt5.2.0\5.2.0\mingw48_32\ or C:\Qt\Qt5.2.0\5.2.0\mingw48_32\bin

  • Insert your application folder.

  • Then copy the folders inside <DRIVE>:\Qt\Qt<Version_qt>\<Version_qt>\mingw<Version_mingw>\plugins

    e.g. C:\Qt\Qt5.2.0\5.2.0\mingw48_32\plugins

  • Paste the folders of your application.

Note. In this example (see below), it was necessary to copy the DLL from different places and remove the Debug DLL (used only for compilation in Debugging ).

Please note that debug dlls ends 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 (your application was created in Qt )
  • c: \ project \ Qt5Core.dll ( dll from the qt / mingw or qt / mingw / bin folder )
  • c: \ project \ platform ( folder from qt / mingw / plugins )
  • c: \ project \ platform \ qminimal.dll ( dll from the qt / mingw / plugins / platform folder)

You only need a few mingw dlls , so I recommend using Dependency Walker 2.2

The result should look like this (not all DLLs are necessary, this may vary depending on the type of project): app folder


Thanks to:

  • +1 for @MartinBeckett, showed me a program for finding DLLs .

  • +1 for @WouterHuysentruit, thanks to the specified application, I found that the contents of the mingw \ plugins folder should be right in the application folder.

    / li>
  • @WouterHuysentruit I would consider your answer to be correct, but you just said, so I will provide a simpler explanation. Thank you anyway.

+10
source

"microsoft visual C ++ runtime library: this application required the runtime to complete it in an unusual way"

This is either a common mistake or sometimes a combination of incompatible dlls. Use the (free) program on your exe to check which DLL files it actually uses - maybe this does not bind all Qt

Some Qt libraries are loaded at runtime from the plugins folder, mainly from image formats and database connections, but they will not give this error

+2
source

windeployqt (ships with QT 5.2+) should do (most?)

0
source

All Articles