How to use VS2015 to develop Qt5 programs

Qt is a very popular open source library for the development of C++ graphical user interface. Visual Studio is a very powerful integrated development environment. It will be very convenient and quick for these two powerful forces to jointly develop C++ applications. Here is how to develop Qt5 programs in VS2015.

Tools/Materials

  • Visual Studio2015

  • Qt5.7.0

Method/Step

  1. Install Qt 5.7 for Windows.

    Download and install [qt-opensource-windows-x86-msvc2015_64-5.7.0.exe] this version of Qt in the following address: http://download.qt.io/official_releases/qt/5.7/5.7.0/.

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

  2. Install the Qt plugin.

    In VS2015, click "Tools"-"Extensions and Updates...", open the [Extensions and Updates] form, click [Online] in the left column, and enter the keyword "Qt5" in the search box on the right ", you can find the extension package Qt5Package, click to download and install, the plug-in will take effect after installing and restarting VS.

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

  3. Configure the version of Qt and the corresponding installation path in the Qt plugin.

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

  4. Add the variable QTDIR to the computer environment variable, QTDIR is the path in the Qt installation directory, for example: "D:\MyInstalledSoft\Qt5.7.0\5.7\msvc2015_64"; add the value to the PATH environment variable: %QTDIR%\bin

  5. 5

    After opening VS, create a new Qt Application project step by step in [Template]-[Other Languages]-[Visual C++]-[Qt5 Projects]. If Qt's environment variable configuration is ok, we can run our Qt Application directly, but if there is a prompt saying "Cannot find some header files", it means that Qt's include and lib are not configured properly, we can go to the project properties page [VC++] Configure the include directory (5.7\msvc2015_64\include directory under the Qt installation directory) and library directory (5.7\msvc2015_64\lib under the Qt installation directory) in the directory. After the configuration is complete, click the [Apply] button to take effect.

    How to use VS2015 to develop Qt5 programs

    How to use VS2015 to develop Qt5 programs

Guess you like

Origin blog.csdn.net/a8039974/article/details/106597178