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.
↧