Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

error lnk2019 in slot and signal qt visual studio 2017



  • Re: [[SOLVED] Qt Visual Studio Add-in](Signal & Slots problems)

    this is my .h file:

    #pragma once

    #include <QtWidgets/QMainWindow>
    #include <QtWidgets/QTreeWidgetItem>
    #include <QtCore/QUrl>
    #include <QtWebKit/QWebElement>
    #include <QtCore/QObject>

    #include "ui_window.h"

    class window : public QMainWindow, QObject
    {
    Q_OBJECT
    public:
    window(QWidget *parent = 0);
    void detUrl(const QUrl &url);
    void on_webView_loadFinished();
    public slots:
    void check();
    private:
    Ui::windowClass ui;
    void examineChildElements(const QWebElement &parentElement,QTreeWidgetItem *parentItem);
    };

    when I compile that I have this error:
    Severity Code Description Project File Line Suppression State
    Error LNK2019 unresolved external symbol "public: void __cdecl window::check(void)" (?check@window@@QEAAXXZ) referenced in function "private: static void __cdecl window::qt_static_metacall(class QObject *,enum QMetaObject::Call,int,void * *)" (?qt_static_metacall@window@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z) window C:\Users\Amin\Documents\Visual Studio 2017\Projects\window\window\moc_window.obj 1

    I use VS 2017 C++ Qt, where is the problem?


  • Lifetime Qt Champion

    @Aminmlp said in error lnk2019 in slot and signal qt visual studio 2017:

    void check();

    Did you implement it in your cpp file?



  • @jsulm you are right, problem solved. thanks


  • Lifetime Qt Champion

    @Aminmlp Then please mark this topic as solved, thx.


Log in to reply