0

I created my UI in QT creator, its in C++ code,

Now i want to connect it to my Backend(C++) which is in Visual Studio 2019, but Visual Studio does not detect these header files

#include <QMainWindow>
#include<QFile>
#include<QFileDialog>
#include<QTextStream>
#include<QMessageBox>
#include<QtPrintSupport/QPrintDialog>
#include<QtPrintSupport/QPrinter

it gives a red line under the #include, i guess its not detecting something and i have to install something, but how exactly do i do it, I have never used Visual Studio ???

  • ***but Visual Studio does not detect these header files*** It should not unless you setup the include path. Also did you install Qt that was built with Visual Studio. mingw binaries will not be compatible. – drescherjm Feb 25 '20 at 02:12
  • ***i guess its not detecting something*** it will not detect anything. You have to tell it where you installed Qt and update your compiler settings for Include and Library paths. – drescherjm Feb 25 '20 at 02:14
  • [https://stackoverflow.com/questions/2676417/how-do-include-paths-work-in-visual-studio](https://stackoverflow.com/questions/2676417/how-do-include-paths-work-in-visual-studio) – drescherjm Feb 25 '20 at 02:21
  • [https://stackoverflow.com/questions/4445418/how-to-add-additional-libraries-to-visual-studio-project](https://stackoverflow.com/questions/4445418/how-to-add-additional-libraries-to-visual-studio-project) – drescherjm Feb 25 '20 at 02:22
  • You need to install [Qt VS Tools for Visual Studio 2019](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2019) – Vladimir Bershov Feb 25 '20 at 11:26

2 Answers2

1

Run qmake -tp vc. This will generate a visual studio project file that will build your qt application. qmake can be found in the bin directory of your qt install

doron
  • 27,972
  • 12
  • 65
  • 103
0

drescherjm already mentioned how to add a library to visual studio.

You need to find the directory to your Qt header files and Qt dll lib which is installed under C:\path\to\Qtxxx\lib and C:\path\to\Qtxxx\include.

Tung Nguyen
  • 104
  • 1
  • 2