Note: I do not guarantee any support for this process, though you are certainly welcome to ask questions in the comments. I’ve executed this tutorial, as-is, on a completely clean 32 bit Windows 7 install with no issues. If something doesn’t work, you probably didn’t follow the steps exactly.
Let’s get right to business!
- Qt Framework – Pre-Compiled version here (Requires 7-Zip). Compiling from scratch, you’re on your own 🙂 It’s a pain and takes several hours.
- Microsoft Visual Studio 2015 Installed (Tested on community or greater)
- Qt Widgets Project Template (Download)
Step 1: Setting up Qt and system PATH variables
- Download and extract Qt to the folder of your choice. For this tutorial, I extracted it to the root of the C drive. This is C:\Qt5.5_MSVC
- Add the Qt bin folder to your PATH. In this case, it’s C:\Qt5.5_MSVC\msvc2015_32\bin
- Create a new system variable called QT55_INCLUDE
Point this to C:\Qt5.5_MSVC\msvc2015_32\include
- Create another system variable called QT55_LIB
Point this to C:\Qt5.5_MSVC\msvc2015_32\lib
Step 2: Setting up Visual Studio 2015
- Install the Qt Visual Studio extension. Go to Tools > Extensions and Updates and search online for Qt5Package. Install this extension.
- Import the Qt Widgets Project Template you downloaded above. To do this in Windows 7, place the zip file in C:\Users\<AccountName>\Documents\Visual Studio 2015\Templates\ProjectTemplates
- To test that this worked, try to create a new project. You should see this:
If you’ll notice, the Qt5Package extension created Qt5 Projects templates. By all means, try using these first. I’ve tried to get it to work, but I only get an error: Cannot instantiate QtProjectEngine object!
Obviously, if you can get the Qt Project wizard to work it’s preferable, but I included a basic widgets project template because I could never figure out how to make it work.
Step 3: Running the Qt Application
- Create a new project based on the template provided. If you try to build, you’ll get an error because no Qt version is specified.
- Go to QT5 > Qt Options > Add. From this menu, click the “…” button and point it to C:\Qt5.5_MSVC\msvc2015_32
- The name field should be automatically populated. You can change this if you wish. After accepting, you should see this:
- Right click on the project and select Qt Project Settings. Under Version select the Qt version you just created.
- Open the qt.conf file. Point the “Plugins” variable to the plugins directory. In my case, it looks like this:
Step 4: Run the project!
Things to keep in mind
- Deployment: This configuration dynamically links to the Qt DLLs in the Qt bin folder so you don’t have to include them in each of your project’s folders.
- If you are getting console spam about symbols not being loaded, refer to this MSDN article.
- The qt.conf is not copied over on a release build. This is intentional.
- The project template uses the system environment variables set in step 1. If you’re having linker errors, you either used a different name or you didn’t set the variable to the correct path.
If this tutorial saved you many hours, or if anything else on this site is useful to you, consider donating!