@[TOC] Problem description
VS2022+QT5.13.2 In the project file, the following error is prompted when generating the solution:
error (activity) E1696 cannot open the source file "ui_QtWidgetsApplication1.h" QtWidgetsApplication1 E:\test\QtWidgetsApplication1\QtWidgetsApplication1.h 4
Error C1083 Cannot open include file: "ui_QtWidgetsApplication1.h": No such file or directory (compile source file QtWidgetsApplication1.cpp) QtWidgetsApplication1 E:\test\QtWidgetsApplication1\QtWidgetsApplication1.h 4
As shown in the figure:
the appearance reason is that ui_QtGuiApplicationx.h does not exist. Anyone who is familiar with QT knows that the header files at the beginning of this kind of ui are usually automatically produced by the IDE, so it can be preliminarily judged that VS did not automatically generate this file.
@[TOC] Solution:
1. Right-click the corresponding ui file, and then select Properties
2. In the pop-up dialog box, change the "Item Type" under the General tab to QT User Interface Compiler(uic).
Then click Apply and OK.
3. Then recompile and run. In the x64\Debug\uic file under the project file, the corresponding ui header file is generated.