Running an App without Qt on Windows
-
I've spent the last two days reading anything I could find about how to get a simple application written using Qt to run on other Windows machines -- machines without Qt. Judging by the amount of discussion I found, this seems like a very common problem, but I couldn't find a clear statement of how to do this. Aside from the fact that I'm new to Qt, part of the problem may be that I'm not as comfortable with Windows as with Linux -- but that's why I chose Qt: so that I can use the same source under both OSes.
I'm running Qt5.0.1 with MinGW under Windows 7. I wrote a simple program that runs just fine when launched from QtCreator. It loads a file and does some string manipulation -- nothing fancy. I put the .exe, which I complied as a "release" version, into a separate folder. I then pulled a bunch of .dlls out of Qt/5.0.1/mingw47_32/bin and put them in the folder with the .exe. After copying those dlls, the program runs on my machine (with Qt installed) from that folder. If I rename my Qt folder to something like "QtHidden" then the .exe no longer works. When I try to launch it, I get "This application has requested the Runtime to terminate in an unusual way" in a dialog titled "Microsoft Visual C++ Runtime Library." That an odd title since Visual Studio hasn't been installed. Leaving that oddity aside, I thought I must be missing some unknown dll(s).
The first thing I did was go to a windows prompt and say "set" to list all of the environment variables. Oddly, I see nothing there that looks like it might be a path to some location with the missing dlls. In fact, I don't see anything obviously related to Qt. Apparently, Dependency Walker is another thing to try, so I fire that up. I did find out that I was missing IEShims.dll, which is odd since my application has nothing to do with networking, but other people have had the same problem, so fine, I copy that over (from the IE directory of all places). Now Dependency Walker is mostly happy. It still says "At least one module has an unresolved import due to a missing export function in an implicitly dependent module," but there are no missing modules. Every module listed is either in the folder with the .exe or it's in C:\windows, so it should be findable. But the .exe still won't launch.
I hope that I don't end up spending a third day spinning my wheels on this.
-
Hi,
Did you take a look at the "deployment guide":https://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html ?
-
Yes, I practically have it memorized.
-
I decided to start over on this problem. I wiped everything from my machine related to Qt, and reinstalled it, then started with a tiny program that does nothing but open a single QMainWindow. I can now run my application on Qt-free machines -- at least on the single XP machine that I've tried so far. I'm not sure what was going wrong before, but others may find the list below helpful. It shows the various dlls that must be in the same directory as the application.
D3DCompiler_43.dll
icudt49.dll
icuin49.dll
icuuc49.dll
libEGL.dll
libgcc_s_sjlj-1.dll
libGLESv2.dll
libstdc++-6.dll
libwinpthread-1.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
platforms/qwindows.dllAll of these, except the last one are found in the Qt/5.0.1/mingw47_32/bin directory. The last one is from Qt/5.0.1/mingw47_32/plugins, and the platforms folder must be in the same directory as the .exe.
Even though Dependency Walker reports that I need IEShims.dll, the program works fine without it.
Figuring out what's needed to run an .exe seems like the kind of thing that should be part of the build process, at least as an option. Having the users figure this out by trial and error isn't very friendly.
-
Hello RSFJ,
I have spend some time with this same problem with Qt-5.0.2. Actually the solution is documented at http://qt-project.org/doc/qt-5.0/qtdoc/qt-conf.html
Basically I made "plugins\platforms" inside my applications folder, platforms contains "qminimal.dll" and "qwindows.dll". Then I made "qt.conf" file in the same folder with my application with the next content:[Paths]
Libraries=./For a simple application (only one window) you must add also inside the application folder:
libgcc_s_dw2-1.dll
libstdc++-6.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dllThis is the same approach followed by the application qtcreator, you can to see "C:\Qt\qtcreator-2.7.0\bin\qt.conf" for a more clarifying example.
This worked flawless for me I hope this solve your problem too.