c++qtvisual-c++visual-c++-2017

How to add Qt libraries to visual studio


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>

Solution

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

    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.