[英]Visual Studio / Qt - Cannot open source file “QApplication”
I have VS 2017 , qt-opensource-windows-x86-msvc2015_64-5.8.0 , qt-vsaddin-msvc2017-2.6.0-rev.07 .我有VS 2017 , qt-opensource-windows-x86-msvc2015_64-5.8.0 , qt-vsaddin-msvc2017-2.6.0-rev.07 。
https://api-2d3d-cad.com/c-qt/ to setup. https://api-2d3d-cad.com/c-qt/进行设置。
Qt VS Tools widget is present, can make Qt Console Application. Qt VS 工具小部件存在,可以制作 Qt 控制台应用程序。
But:但:
#include <QMainWindow>
#include <QLabel>
Cannot open source file "QApplication"
Cannot open source file "QLabel"
https://stackoverflow.com/a/16682269/10226040 - tried, not working. https://stackoverflow.com/a/16682269/10226040 - 尝试过,不工作。
Thx.谢谢。
To use Qt libs in Visual studio do next steps!要在 Visual Studio 中使用 Qt 库,请执行以下步骤! This answer is based on Visual studio 2017
, on other versions, differences are only on menus or settings interfaces!此答案基于Visual studio 2017
,在其他版本上,差异仅在菜单或设置界面上!
Install Qt Vs Tools
, check its version compatibility with Visual studio安装Qt Vs Tools
,检查其与 Visual Studio 的版本兼容性
In Qt Versions
tab, add installed Qt libs with its path and name, and set default Qt/Win version在Qt Versions
选项卡中,添加已安装的 Qt 库及其路径和名称,并设置默认 Qt/Win 版本
Check Qt Default Settings
tab, it seems as below检查Qt Default Settings
选项卡,如下所示
On Solution Explorer
view, open project properties, go Qt Project Settings
and on Qt Modules
tab set required modules such as Core
.在Solution Explorer
视图中,打开项目属性,go Qt Project Settings
和Qt Modules
选项卡上设置所需的模块,例如Core
。 You can see other settings in tabs Qt Meta-Object Compiler
to change moc
file generation settings, Qt User Interface Compiler
to change form
and ui
compilation settings.您可以在选项卡中查看其他设置Qt Meta-Object Compiler
以更改moc
文件生成设置, Qt User Interface Compiler
以更改form
和ui
编译设置。
If you have any form file, ie *.ui
file, you can get its properties and check followings are set properly by default!如果您有任何表单文件,即*.ui
文件,您可以获取其属性并检查以下是否默认设置正确! or modify them as you need!或根据需要修改它们!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.