The typical method to create Qt applications is use its Qt Creator as the IDE to write and debug Qt code. (See this post for info.) If you use Visual Studio, you might find it frustrating to learn yet another IDE. In such a case, you can actually create Qt applications using Visual Studio.
- Download a suitable Qt installer from the downloads page and install it. Make sure you pick an installer that is 32-bit and built for the Visual Studio version that you have.
Download and install the Qt Visual Studio add-in. You can find it at the bottom of the downloads page. Make sure you pick an installer that matches the Visual Studio version that you have. At the time of this writing, the Visual Studio add-ins were built only for 32-bit version of Qt. That is the reason I used 32-bit in Step 1.
Open your Visual Studio. In the toolbar, there is a new menu named
Qt5. Go to Qt5 > Qt Options. In the
Qt Versionstab, add the path to the Qt you installed in Step 1. Note that you need to add the path to the parent directory of the
bindirectory of Qt. For example, on my particular installation this path was
Create a Qt project. To do this, open File > New > Project and choose Qt5 Projects > Qt Application. After you provide the name and path, a Qt wizard pops up to handle the Qt specific details of this project. Once you are done with it, you will be dropped into a project with sample source and interface files.
Build the Qt project by choosing Build > Build Solution. This is where the Qt add-in steps in and does its meta-object magic before letting the Visual C++ compiler to compile the generated files.
The build should hopefully succeed. You can now execute and even debug the Qt application from Visual Studio.
Tried with: Qt 5.2.0, Qt Visual Studio add-in 1.2.2, Visual Studio 2012 and Windows 7 x64