Nominate our 2022 Qt Champions!

QCamera error LNK1120 (with Visual Studio+Qt6.5.2)

  • I am trying and tryin to define a QCamera Variable in my Code, but always comes an exception or this error:
    Qt3BotonCalibrar.obj : error LNK2019: símbolo externo "__declspec(dllimport) public: virtual __cdecl QCamera::~QCamera(void)" (_imp??1QCamera@@UEAA@XZ)
    This is happening everytime I write in my MainWIndow.h "QCamera *camarita = new QCamera;"

    #pragma once

    #include <QtWidgets/QMainWindow>
    #include <QPainter>
    #include "ui_Qt3BotonCalibrar.h"
    #include "ui_WidgetForm_V2.h" //<---V2---- Incluir su librería
    #include "ui_WidgetForm_V3.h" //<---V2---- Incluir su librería

    #include <QtCore> //Para el timer

    #include <iostream> //para los int del tamaño de la pantalla
    #include <Windows.h> //para los int del tamaño de la pantalla

    #include <QtMultimedia/QCamera>
    //#include <QCamera>
    //#include <QtMultimediaWidgets/QCameraViewfinder>
    #include "qcamera.h"
    //#include "QtMultimedia/qcamera.h"
    //#include "QtMultimedia/QCameraInfo.h"

    class Qt3BotonCalibrar : public QMainWindow

    Qt3BotonCalibrar(QWidget *parent = Q_NULLPTR);
    void paintEvent(QPaintEvent *event);
    QTimer reloj;
    static int contador;
    QCamera camarita = new QCamera;// ("/dev/video0");
    viewfinder = new QCameraViewfinder;

    It seems to be a problem with libreria or includes, but I have already tried to add <QCamera>, and also added "$(QTDIR)\include;$(QTDIR)\include\QtMultimedia;" in Proyect-Properties in Visual Studio, but no way...
    I have checked and the Files are in those folders, but still not working and I am running out of ideas.
    Could you please help me?

  • Lifetime Qt Champion

    @Ammie said in QCamera error LNK1120 (with Visual Studio+Qt6.5.2):


    You need to add
    QT += multimedia
    to your .pro file.

    alt text

Log in to reply