Windows users should have to perform 4 steps if they want to use my Qt desktop program.
- Install the MSVC redistributable package.
- Download a zip file from my website.
- Extract the zip file.
- Double-click the executable.
I make no assumptions about what is already installed on their machines. I can use an installer to remove the burden of installing the MSVC package, but for now I’ll do this manually.
Development Setup and Test Program
My development setup is as follows.
- Visual Studio 2010
- Qt SDK 5.1.1 (OpenGL) for MSVC2010 32-bit
To make this as simple as possible, I simply created a brand new GUI project in Qt Creator, and changed no settings whatsoever from the wizard’s defaults. I modified no source code, and ran the program once in Release mode inside of Qt Creator in order to produce the binaries.
Target Machine
I’m using VMWare in order to test each zip file I make to see if it will run on a clean install of Windows 7 x64 Home Premium.
Create the Zip
I’m going to use absolute paths, but obviously you should substitute your own as appropriate.
- Create an empty folder that will house your executable and associated DLL files.
- Copy the release .exe into the folder. You do not need the manifest file.
- Go into C:\Qt\Qt5.1.1\5.1.1\msvc2010_opengl\bin
- Copy any required DLLs and paste them next to the .exe in your new folder. If you are running into problems, just copy all of them in order to eliminate this step as a source of problems. Once you get everything working, you can prune out unnecessary DLLs using Dependency Walker. For the default test application, I needed: Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll, and all of the dll’s prefixed with “icu.”
- Go into C:\Qt\Qt5.1.1\5.1.1\msvc2010_opengl\plugins\platforms
- Copy qwindows.dll and paste it in <your new folder>\platforms. You have to perform this step for all applications, even if you don’t know what plugins are or don’t think your application is using any.
- Compress your new folder.
Finding the Right Redistributable
It turns out that Qt packages the appropriate redistributable installer with itself. Instead of hunting around for it on the internet, just use theirs.
- Go into C:\Qt\Qt5.1.1\vcredist
- You should see something like vcredist_sp1_x86.exe.
Final Process for End Users
After uploading the zipped installation folder and the corresponding redistributable provided by Qt, the installation process on the VMWare Windows 7 x64 machine looked like the following.
- Download vcredist_sp1_x86.exe.
- Run the installer, using all default settings.
- Download the zipped installation folder.
- Unzip.
- Double-click executable.
Conclusion
Getting this to work took me longer than expected, but that was due to two problems. First, having multiple Qt installations on my development machine must have resulted in me copying the wrong dll’s or using the wrong version of Qt Creator, or something. Uninstalling all versions of Qt, deleting the corresponding folders, then installing only the version I wanted to use made debugging much easier. Second, attempting to find the MSVC redistributable package on the web was difficult. It was never clear if I was downloading the right version; finding and using the one provided by Qt helped tremendously and worked the first time.