How To Deploy Qt MinGW application for windows - qt

I have develop an application by using QT/ MinGW 32 bit.This app work on my pc Windows 8. But ı want to deploy this app to my friends whose computers has windows 7. How to deploy it.Is there a necessary programs,framework to work it like .net framework, C++ runtime etc.. I don't know.I can't find a clear solution

To deploy a Qt app on Windows, you'll need to gather files from a few different locations. Here is an example how to do it.

See http://doc.qt.io/qt-5/windows-deployment.html, section "Creating the Application Package". You just have to copy all the necessary DLLs (and other files in case of Qt Quick) to the same directory as executable file. The best way to test whether you have all the required files is to rename your Qt installation directory (C:\Qt) to something else and try to double-click your executable.
Deployment on Windows 7 is no different from Windows 8.

Related

QT Creator QPrintDialog appears on development machine, but not on other machines

I am having trouble deploying an application on machines other than my development machine.
I have a Print button on several menus which works well on the development machine, when running in a Release build in QT Creator. However when I build the project into a .msi file using WiX and distributing it to other computers the Print dialog will not appear. Is this most likely a problem with my WiX file? The version of the .dll file I am using? The .pro file (which includes printersupport in it)? How is it that QT Creator can find and run the code needed for the dialog but other systems cannot?

Can't launch Qt Quick Controls application

I downloaded Qt 5.4 and created Qt Quick application with Qt Quick Controls 1.3.
I didn't change anything in code, just built it (as release). Then I copied .exe to another folder, added all the .dll files I needed and when I launched my program there was no window, just the program process running in the Task manager.
However, I can launch program which uses QtQuick 1.1.
How can I fix it?
Thanks.
Here is an image for some more explanation:
Try to deploy your application using The Windows Deployment Tool which copies all DLL and other files necessary for deployment alongside your application executable automatically.
The Windows Deployment Tool could be found in QTDIR/bin/windeployqt.exe
Open your command prompt and add the path to your Qt directory and it's bin folder to the PATH variable like :
set PATH= path\to\Qt\bin
Next run the windows deployment tool with your application path as the argument:
windeployqt.exe <path-to-app-binary>
This way you make sure that the deployed application would work on any computer and you have included whatever necessary.
Sounds like you are missing the platform plugin. It should be in the folder of the executable, in a platforms subfolder. That's why you aren't getting a window - the runtime fails to load the platform support plugin. On windows that should be a qwindows.dll file.

Cannot deploy my Quick 2 app to a Windows system without Qt installed

I am using Qt 5 with Visual Studio compiler. I have a Quick 2 application with a c++ backend.
I have bundled together my exe, a bunch of dll files, and all of the plugins from Qt, into a single folder. When I run the exe in this folder on a system with Qt installed but Qt Creator closed, it runs fine. When I run it on a system without Qt installed, it does not crash, but it just opens a small 1-inch square window that is all white, nothing else.
I am using a Qt resource file for the QML, so there are no standalone QML files that could be getting missed by the exe. Again, it runs fine on a system with Qt, so what else could I be missing? Dependency walker does not report any problems.
Here is what is in my app directory:
I've been looking at this for hours and I cannot understand what I must be missing (or why Windows deployment is so challenging with Qt).
The problem was resolved by also adding these directories:

A qt5 simple app doesn't run in windows 7

I use Qt 5.0.1 and Qt Creator 2.6.2 in W7. I tried to run a simple app from examples which contains only a window ("Widgets tutorial - creating a window"). When I run it in Qt Creator, it works. But when I run it as a standalone app (Release), it doesn't.
I filled the folder with every dll it had asked (26 MB of dlls, while the app is 10KB!!!). Now it doesn't ask for any files, it just doesn't run at all with no explanations.
I tried to add some files as it is advised in Application deployed with QT5 libraries does not start on Windows 7
but no luck. In
HelloWorld Deployment with QtQuick 2.0 in Windows 7 and XP
there are no problems in w7.
May be this a dependency problem, These links describes it:
Qt 5.0 program runs in QtCreator but not outside
How to build QTcore4.dll without dependency to MSVCx80.dll?
platforms/qwindows.dll is a "non-required" required DLL to run Qt5 apps. Build your app in Release mode and steal the DLL from Qt Creator's folder (or find it into Qt's bin/platforms folder)

Qt and Qt application prerequisites

I am new to Qt, and I am working in Windows 7.
When I try to run my application directly, I see an error about missing some DLLs. I tried to fix them, but I could not (I tried to build statically).
Is there any correct solution?
My question is:
If I want to run my Qt application on other computers, what do I need? For example, for a .NET application we need to install the .NET framework on the target computer, but what about for Qt?
I searched for its SDK and found a SDK that was about 1.6 GB! Does this mean every time I want to install my application I should install a 1.6 GB sized SDK? That's far too bad.
Thanks.
You have to distribute your application with needed libraries.
If your application is running on Windows you can follow this guide: Deploying an Application on Windows. You can find needed libraries as dll in bin directory inside SDK. A basic Qt gui application needs at least QTCORE4.DLL, QTGUI4.DLL and, if you are using Qt Creator, MINGWM10.DLL. You can leave these libraries in the same directory as you application.
You can't link statically against Qt unless you have built the libraries in that configuration (which you won't if you've just downloaded the pre-built SDK). Be aware that if you do want to link statically there are licensing implications for some components.
If you have built a release configuration then you will need at least the libraries Alessandro mentioned, QtCore4.dll and QtGui4.dll. Depending on the other parts of the library you're using you may also need QtXml4.dll QtWebkit4.dll, QtXmlPatterns4.dll and possibly Phonon.dll. Check that you are building a release configuration rather than a debug configuration, as this won't run as it needs the Visual Studio debug runtimes, which you can't redistribute. If you are in doubt which dlls you need then use DependencyWalker to find out (note that this doesn't show Phonon.dll as it is loaded later).
Generally you'll only need about 4-6 of the dlls, you won't need the whole SDK.
Please consider that many applications use Qt, you have some real chance the DLLs are already installed. Anyway, beware of MSVC dependencies: we had some real nightmare deploying applications on some server, partly related to a policy switch from VS2005 to VS2008. Alessandro already given a good resource: see also this previous post.
If you're working with Qt5, besides the .dlls mentioned by the first answer, you must also add the platforms/ folder from the bin directory inside the SDK.

Resources