c++qtqt3dqt-vs-addin

QT - how to fix link error 2019 with qt VS tools


I'm trying to create a simple qt application in visual studio, I also made sure to install all qt components.

Code:

#include "QtWidgetsApplication2.h"
#include <QtWidgets/QApplication>

#include <QtDataVisualization/Q3DSurface>
#include <QtDataVisualization/QSurfaceDataProxy>
#include <QtDataVisualization/QHeightMapSurfaceDataProxy>
#include <QtDataVisualization/QSurface3DSeries>
#include <QtWidgets/QSlider>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QtWidgetsApplication2 w;

    Q3DSurface* graph = new Q3DSurface();
    QWidget* container = QWidget::createWindowContainer(graph);

    w.show();
    return a.exec();
}

I have already set the correct QT version, and the path to the aditional libraries for the linker(at C:\Qt\6.4.0\msvc2019_64\lib) but somehow i'm still getting an error linker LNK2019. What gives?

EDIT:

my .pro file:

TEMPLATE = app
TARGET = QtWidgetsApplication2
DESTDIR = ../x64/Debug
CONFIG += debug
DEPENDPATH += .
MOC_DIR += .
OBJECTS_DIR += debug
UI_DIR += .
RCC_DIR += .
include(QtWidgetsApplication2.pri)

Solution

  • From the Qt documentation for Q3DSurface here: https://doc.qt.io/qt-6/q3dsurface.html on the qmake line at the top it has qmake: QT += datavisualization the QT += datavisualization part is what you need to add to your .pro file to use the Q3DSurface class. This will setup the linking and any additional include directories.