如何将Qt库添加到Visual Studio [英] How to add Qt libraries to visual studio
问题描述
我有VC ++ 2017的来源当我尝试编译项目时,收到错误"错误C1083无法打开包含文件:'QtCore/QMap':没有这样的文件或目录".我下载了Qt库并将其添加到包含"项目中,但是存在问题.我必须将Qt的哪个目录添加到项目中才能解决错误?
I have a source with VC++ 2017 I receive the error "Error C1083 Cannot open include file: 'QtCore/QMap': No such file or directory " when i try compile the project. I download Qt libraries and add to Include project but the problem exist. Which directory of Qt of i had to add to project to resolve error?
这是我的代码头,会产生错误
this is header of my code that generate error
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QList>
推荐答案
您需要更新您的项目.在解决方案资源管理器中右键单击项目属性,然后选择 Properties
.然后:
You need to update your project. Go to the project properties by right-clicking on it in Solution Explorer and then select Properties
. Then:
- 在
C/C ++->常规->其他包含目录
中,您必须设置Qt安装包含路径; - 在
Linker-> General->其他库目录
中,您必须添加qt安装的.libs文件的路径; - 在
Linker-> Input-> Additional Dependencies
中,您必须放置构建项目所需的.lib文件的名称.
- In
C/C++->General->Additional Include Directories
you must set the Qt installation include path; - In
Linker->General->Additional Library Directories
you must add the path of .libs files of your qt installation; - In
Linker->Input->Additional Dependencies
you must put the name of .lib files that you need in order to build the project.
如果它是Qt项目,则还应该安装Qt插件,以便与 moc
和其他Qt功能一起正常工作.
If it's a Qt project, you should also have the Qt plugin installed, in order to work properly with moc
and other Qt features.
(我建议)替代地,您可以创建一个CMake项目并在Visual Studio中打开.
In alternative (that I suggest) you can create a CMake project and open in in Visual Studio.
这篇关于如何将Qt库添加到Visual Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!