How to add Qt libraries to visual studio

只愿长相守 提交于 2021-02-05 20:37:32

问题


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>

回答1:


You need to update your project. Go to the project properties by right-clicking on it in Solution Explorer and then select Properties. Then:

  • 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.

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.

In alternative (that I suggest) you can create a CMake project and open in in Visual Studio.



来源:https://stackoverflow.com/questions/49221328/how-to-add-qt-libraries-to-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!