Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 720
MH2538 Avatar asked Mar 11 '18 14:03

MH2538


People also ask

How do I add a QT in Visual Studio?

In Microsoft Visual Studio, select Extensions > Manage Extensions > Online, and search for Qt Visual Studio Tools to install or update Qt VS Tools.

How can I add Qt version in Visual Studio 2022?

Installation packages are available for download at the VS Marketplace or directly in the VS 2022 IDE: select Extensions > Manage Extensions from the IDE menu, and then search for "qt". Version 2.8.


1 Answers

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.

like image 200
Jepessen Avatar answered Sep 25 '22 02:09

Jepessen