Basic knowledge
How to build and debug the vs2022 qt environment
Suggestion: install qt first and then install vs!
1. Install qt6, as shown in the figure below, just check msvc2019, the rest is at your own discretion, and the rest of the installation is automatic;
2. There is nothing to say about the installation of vs2022, because it is already a modular installation, as shown in the figure below, which is the least checked;
3. Install the qt vs tools plug-in, vs extension, extension management, search for qt, then install it, and restart vs to take effect.
4. Generally, it will be automatically recognized. If there is no manual, specify the path of qt in the qt versions in the extension, and must specify the mscv2019_64 folder in the qt installation directory.
5. Create a new project, there is a qt project menu directly, follow the next step in order, and then the next step can be done;
6. Because qt6 requires C++17, the vs project properties need to be changed in two places, as follows:
①Project right-click properties, c/c++, command line, paste /Zc:__cplusplus
②Project right-click properties, general, select c++17
Remarks: The above is the whole process of vs2022 and qt6. How to install qt6 online is beyond the scope of discussion. Please note that all versions of qt6 and vs2022 are currently combined:
Only supports output 64 for the application!
Only supports output 64 for the application!
Only supports output 64 for the application!
At this point, some people may ask, is the combination of qt5 version and vs2022 OK? I haven't tried it but I think it's completely possible, and can support output 32-bit and 64-bit, the reasons are as follows:
Therefore, if you need 32-bit, please be sure to install Qt5.15.0, Qt5.15.1, Qt5.15.2 and choose one of the three versions, and you must check both in the red box! Qt5.14 does not support vs2019, only 2017.
So can it be concluded that the lower version must not support it, I don't think it is necessarily, but it is not recommended!
Because the compilation environment is stable is the first choice, as shown in the figure below, a new qt5.5 project is created with vs2022, and the compilation is passed, but it needs to correspond to the windows sdk version and so on.
Solve the package error: If you configure it, the following prompt appears when compiling
"Unable to open the included file "stddf.h", no such file or directory, most of the tutorials on the Internet are temporary solutions, let the directory be added to the project configuration, but this solution actually solves the symptoms but not the root cause, and it cannot be solved every time in the future. Add all items!
In this case, re-verify, vs directly create a new console project, and continue to report the following error:
"Cannot open include file "crtdbg.h", no such file or directory
All right, don't doubt it, the VS installation itself is a problem! ! ! , you need to follow the steps below,
Uninstall, restart the computer, reinstall vs,
Choose to install when downloading, wait for the reinstallation to complete, and after installing the vs qt tool, the qt version will be automatically recognized, and you can compile it smoothly!
So far, this article about the method and steps of building and debugging the vs2022 qt environment is introduced here. For more information on the construction of the vs2022 qt environment, please search for the previous articles of the Yunhaitian tutorial or continue to browse the related articles below. I hope you will support Yunhai more in the future. Day tutorial!
If the content of this account is not in place (for example, involving copyright or other issues), please contact us in time for rectification, and we will deal with it as soon as possible.