error: Project ERROR: Unknown module(s) in QT: vtk

I Installed and setup VTK on my windows 10. Updated .pro file as below
QT += core gui
QT += vtk
QT += widgets

CONFIG += c++17

You can make your code fail to compile if it uses deprecated APIs.

In order to do so, uncomment the following line.

#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
INCLUDEPATH += “C:\Program Files\VTK\include\vtk-9.3”
INCLUDEPATH += “C:\VTK-9.3.0\GUISupport\Qt”
LIBS += -LC:\“Program Files”\VTK\lib -lvtkCommonCore-9.3 -lvtkRenderingCore-9.3 -lvtkInteractionStyle-9.3

SOURCES +=
main.cpp
mainwindow.cpp

HEADERS +=
mainwindow.h

FORMS +=
mainwindow.ui

Default rules for deployment.

qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

but getting error unknown module.
If I removed “QT += vtk” than getting linking error for all vtk library.
Please suggest what I am missing

VTK does not provide anything that would make QT += vtk work in qmake. You’ll have to list libraries that you need by name (like for any other third party package in qmake).

but if I removed that QT += vtk getting below errors


how can I resolve these error.
My code is #include
#include
#include <vtkSmartPointer.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkLine.h>
#include <vtkPolyData.h>

int main(int argc, char *argv)
{
QApplication a(argc, argv);
QMainWindow window;

// Create a VTK renderer, render window, and interactor
vtkSmartPointer<vtkRenderer> renderer =
    vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
    vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
    vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);

// Create a vtkPoints object to hold the well path points
vtkSmartPointer<vtkPoints> points =
    vtkSmartPointer<vtkPoints>::New();

// Create a dummy well path
points->InsertNextPoint(0.0, 0.0, 0.0); // Start point
points->InsertNextPoint(10.0, 0.0, 0.0); // Next point
points->InsertNextPoint(20.0, 5.0, 0.0); // Another point
points->InsertNextPoint(30.0, 5.0, -5.0); // Another point
points->InsertNextPoint(40.0, 10.0, -5.0); // End point

// Create a vtkCellArray to hold the lines connecting the points
vtkSmartPointer<vtkCellArray> lines =
    vtkSmartPointer<vtkCellArray>::New();

// Create a line connecting each pair of adjacent points
for (vtkIdType i = 0; i < points->GetNumberOfPoints() - 1; i++)
{
    vtkSmartPointer<vtkLine> line =
        vtkSmartPointer<vtkLine>::New();
    line->GetPointIds()->SetId(0, i);
    line->GetPointIds()->SetId(1, i + 1);
    lines->InsertNextCell(line);
}

// Create a vtkPolyData object to hold the points and lines
vtkSmartPointer<vtkPolyData> polyData =
    vtkSmartPointer<vtkPolyData>::New();
polyData->SetPoints(points);
polyData->SetLines(lines);

// Create a mapper and actor for the well path
vtkSmartPointer<vtkPolyDataMapper> mapper =
    vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputData(polyData);
vtkSmartPointer<vtkActor> actor =
    vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);

// Add the actor to the renderer
renderer->AddActor(actor);

// Set the background color
renderer->SetBackground(0.1, 0.2, 0.4);

// Initialize and start the interactor
renderWindow->Render();
renderWindowInteractor->Start();

return a.exec();

}

You’ll have to link to VTK libraries. It looks like you’ll need at least vtkCommonCore, vtkRenderingCore, and vtkRenderingOpenGL2. There may be others as well. I don’t know qmake enough to tell you how to do it, but you’ll have to use the library names I imagine.