I created an application using Qt 5 (compiled with Visual Studio '12). It works on my machine.
However, it doesn't work when I attempt to run it on another machine. The output I collected through cmd yielded an empty file.
The directory structure is as follows:
myapp.exe
icudt52.dll
icuin52.dll
icuuc52.dll
libEGL.dll
libGLESv2.dll
msvcp120.dll
msvcr120.dll
Qt5Core.dll
Qt5Gui.dll
platforms/qminimal.dll
platforms/qwindows.dll
The most relevant post I found was Application deployed with QT5 libraries does not start on Windows 7 - yet the solution (including qwindows.dll & qminimal.dll) didn't work.
Any ideas?
Windows will report a number of launch errors just when you double click on your exe outside Qt Creator. It looks like you have included most or all of these already.
Your development machine typically will not have problems launching and running its qt plugins because of the LibraryPaths that are searched by your exe. http://qt-project.org/doc/qt-5/qcoreapplication.html#libraryPaths
Dependency Walker will do the job and show you what you need to know, but the output is pretty complex and can be hard to decipher.
The easiest way I have found to figure out what Qt plugin dlls I am using at runtime on Windows is to do the following:
Exit Qt Creator.
Open the install folder for the compiler you are using with Qt in Explorer. For example:
C:/Qt/5.3/msvc2010_opengl/
Create a copy of the plugins folder in place (Copy of plugins folder in the same path as plugins, so its parent is msvc2010_opengl in this case).
In another explorer window, open your exe (Qt program) on your development machine. Run a minimal test of your program to make sure the major features are working. (Many runtime plugins don't get loaded until QObjects that use them are instantiated).
Delete the plugins folder in the Qt path.
Windows will lock up all the dlls that are in use by your exe and prevent you from deleting a number of dlls. Click skip for all the un-deletable folders and files.
Now go into each of the folders that you couldn't delete before and try to delete all the individual dll's in each folder. Click skip for all the un-deletable dlls.
Now when you are all done, you are left with a skeleton of a plugins folder, only showing dlls that your application is using.
It will probably include the folders: accessibility, platforms and imageformats and more depending on what you included in your .pro file.
Close your exe.
Copy the contents of your stripped down plugins folder to sit right next to your exe.
Restore your backup of the plugins folder (delete the stripped down plugins folder from your Qt path and restore the Copy of plugins).
Now you should be good to go. Test on a non-development machine.
A Note on VS C++ Runtimes
Also on some machines when deploying Qt with MSVC, the msvcrXXX.dll doesn't match what the rest of the system is using. Instead of deploying msvcrXXX.dll, instead in our installers at our office, we include the Microsoft C++ Redistributable Installer and run it in the install script. And on a few machines they had corrupted Redistributables, and we had to do a force install of redistributables to fix the `Referral from server' error we would sometimes get.
You can find the latest installer for MSVC Redistributables here Latest Supported Visual C++ Downloads.
Hope that helps.
You have to deploy your application before copying dll files manually.
To deploy your Qt application on Windows you can use windeployqt which can be found in:
< QTDIR >/bin/windeployqt
Example batch script may work on deploying your Qt Application (run with PowerShell or cmd):
C:\Qt\Qt5.x.x\5.x.x\MSVCx_x\bin\windeployqt <APP_PATH>/myapp.exe
After deploying your app, try to run your myapp.exe and note which dll files are missing.
Copy / paste required dll files from QTDIR/bin to your < APP_PATH >
for more information about deploying:
Windows Deploying Tool - windeployqt
Deploying on Windows
Related
I am using Visual Studio 2019 on Windows 10 and am trying to use GTK in C++ and installed it using vcpkg.
I've installed GTK using vcpkg according to the guide from GTK. I'm using Visual Studio 2019 and it is able to compile and run the example program here, but there is an issue regarding the theme and icons. According to the installation guide, under the section Building and distributing your application there are some things that must be done to get themes and icons to work.
I've started by downloading the Windows theme the guide suggests and have it in a share directory and then I've created a settings.ini file in an etc directory. It says to place this in the "install directory", which I assume is where Visual Studio is placing the exe for the program. I've tried it in both build and release, in the source files, in the top project directory - all with no success (and I did make sure it is targeting x64).
Just in case I also tried placing these where vcpkg is installed as well as where vcpkg installs gtk. No luck. When the program runs I get the warning
(gtkExample0.exe:16772): Gtk-WARNING **: Could not find the icon 'window-minimize-symbolic-ltr'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
http://icon-theme.freedesktop.org/releases
So it seems that it is never finding the ssettings.ini file telling it to use the Windows 10 theme. Has anyone had any luck with getting this to work (both from VS2019 debugging runs and in deployment)?
To summarize the files:
share\themes\Windows10\gtk-3.0\gtk-3.20\ (downloaded from suggested GitHub repo)
etc\settings.ini contains:
[Settings]
gtk-theme-name=Windows10
gtk-font-name=Segoe UI 9
I've placed these in
<VS2019Project>\x64\Release,
<VS2019Project>\x64\Debug,
C:<path_to_vcpkg>\vcpkg\packages\gtk_x64-windows,
C:<path_to_vcpkg>\vcpkg\installed\x64-windows
All with no change when running from VS2019 under Release or Debug.
Theme and icons considered as external resources are not distributed by vcpkg, and the instructions given in the distribution guide from GTK regarding where these resources should be layout on windows 10 are not crystal clear. The problem has also been reported here vcpkg issue#4417.
The solution proposed hereunder is to install
all the resources in the <VS2019Project>\x64\Release directory of your VS project where your .exe application lives [This is a local solution the problem. A global approach should consider the setting of some user-defined free desktop environment variables which is not discussed here]. Icons can be picked from an ancillary MSYS2 distribution and the theme as indicated in the GTK Guide. The solution should be replicated for the Debug branch.
Supposing you have MSYS2, install mingw-w64-x86_64-adwaita-icon-theme package with the pacman package manager if not already done on your MSYS2 installation pacman -Syu mingw-w64-x86_64-adwaita-icon-theme.
Copy C:\msys64\mingw64\share\icons to <VS2019Project>\x64\Release\share\icons
you should get both hicolor and Adwaita icons as subdirectories of your target dir.
Copy the theme resources downloaded in the source gtk-3.20 directory directly into <VS2019Project>\x64\Release\share\themes\Windows10\gtk-3.0\. Do not locate these resources into a gtk-3.20 subfolder: to understand why consult this article Theme Location [assuming here that no global desktop environment variable has been set].
Create a <VS2019Project>\x64\Release\etc\gtk-3.0 directory, put your settings.ini into it.
Recompile and you should obtain a windows 10 look and feel for your application window.
I am developing a desktop application using QT Quick. I have been searching and reading the QT documentation (http://doc.qt.io/qtinstallerframework/ifw-tutorial.html) for creating an installer and how to use windeployqt.exe and binarycreator.exe to deploy on a windows machine. So far so good , but since I want to target this application for windows XP as well.
I want to know exactly what is required to be installed on the target machine to be able to run my application when using MinGW orMSVC2015 during building, so that I may include them in my installer or make the end user download them. Just like we download .Net Framework , Visual C++ Redistributable or DirectX when installing an application.
We use windeployqt to gather all the Qt official dependencis. Two parameters of windeployqt are quite useful:
--debug or --release: determine whether your app is in debug state or release state. windeployqt will put corresponding version of DLLs to your exe's directory;
--qml and put the directory of your QML files after it. windeployqt will search your given directory and put all the QML modules to your exe's directory.
2018-11-05 10:52:34:
It seems the second parameter --qml has been changed to --qmldir.
I did an application with Qt5.5, wich use open cv.
It works, so now I want to deploy it on several computers.
On the first PC (PC1), it works too : I copied the dll of Qt and open cv and add the paths in the environment variables. I copied a folder with my application, some dll and datas (images).
On the second PC (PC2), I did the same, but I can't open the application. I have the error "msvcp120d.dll is missing..".
I compiled my app in release mode.
On my PC and PC1 I moved msvcp120d.dll on the desk, and the app don't request it.
Do you know why the app asks a debug dll?
I soon installed the redistribuables packages visual C++ (x64 and x86) on PC2, but it doesn't install msvcp120d.dll.
Do you have an other idea?
thanks'
It seems like some of the libraries that you are using is linking against a Debug CRT library (indicated by the trailing d in "msvcp120d.dll"). Those aren't redistributable, and are only available on systems, where Visual Studio is installed.
I would recommend to use dependency walker to find out which dlls/libraries that need the debug version and then recompile them as release configuration.
I am new to Qt, I installed Qt 5.6 and Microsoft compiler (I have Visual studio 2015 community).
It works.
I am focused on QML desktop applications on Windows 7/8/10.
I can't find informations about how to deploy Qt dlls once: if I make many applications that I deploy inside corporate LAN, I would like to install all the Qt dll required in one central location, so then I will speed up the edit/compile/test/deploy cycle.
I want to install every app in its respective folder, but the Qt "runtime" and dll only ONCE, not in EVERY app's folder.
That would be a huge time waste and space (and money).
How can I do? Is this possible?
thanks
Use cqtdeployer with deploySystem option.
This utility can deploy system libraries.
Warning, deploying system libraries may cause some qt modules to work incorrectly.
install catdeployer from online installer
open cmd
and call cqtdeployer with options:
cqtdeployer myApp.exe -qmlDir path/to/my/QML/folder -qmake path/to/my/qmake.exe -deploySystem
Where:
myApp.exe -you deployment application (release version)
-qmlDir path/to/my/QML/folder - this is path to your project qml folder
-qmake path/to/my/qmake.exe - the path to qmake that you were going with.
-deploySystem - option to capture system libraries.
If you wish, you can add the qif option to the end, this will force cqtdeployer to create an installer for your program.
cqtdeployer myApp.exe -qmlDir path/to/my/QML/folder -qmake path/to/my/qmake.exe -deploySystem qif
I tried making an executable file of my program but there are some errors which I did not understand or could not find solutions of. I used my .exe file onto another computer and there was an error. I made my program through QtCreator (v 5.1.1)with my Windows 7, 64-bit laptop. There was an error when I used it in 2 32-bit laptops.
The error message says:
This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: minimal, offscreen, windows.
Reinstalling the application may fix the problem.
I already created a new folder called "platforms" containing "qminimal.dll", "qoffscreen.dll" and "qwindows.dll" in the same level of my .exe file. I also pasted in the same level the other DLLs that my program needs.
In Qt 5.2, there is a tool that can be used for deployment on Windows: windeployqt. It will be in the bin folder of your Qt installation. It greatly simplifies deployment, so if you don't mind downloading a newer Qt version, I'd highly recommend it. It may even work with an older Qt version, but I haven't tested it.
We had exact same problem with Qt5.3.
Problem arised when we've rebuilt the Qt to reduce dependencies (e.g. Qt5Positioning, Qt5Sensors).
Created dlls were copied to different directory (source for installation), but we forgot to copy also newly created platforms plugin dlls.
The problem was fixed by using all dlls from same Qt build (with same configuration).
Your problem is probably the same: mixing dlls from different Qt builds (e.g. different configuration, version,...).