Link error with signal in Qt5



  • Hello,
    I try to use signals and slots in my projects (with Qt5) and I have this link err :
    @
    _myWidget.obj:-1: erreur : LNK2019: symbole externe non résolu "public: void __cdecl DragWidgetCible::enableProcess(int)" (?enableProcess@MyWidget@@QEAAXH@Z) référencé dans la fonction "protected: virtual void _cdecl MyWidget::dropEvent(class QDropEvent *)" (?dropEvent@MyWidget@@MEAAXPEAVQDropEvent@@@Z)
    @

    In fact,
    I have this class
    @
    class MyWidget : public QFrame
    {
    protected:
    ....
    public:
    ...
    signals:
    void enableProcess(int);

    private slots:
    ...
    };
    @
    And I use emit enableProcess(int) im my function *void MyWidget::dropEvent(QDropEvent event)

    but the compiler says that my program cannot find the signals. ( I tried Q_OBJECTS but no result )

    Thank you for help

    [andreyc EDIT]: Added '@' around the code.



  • Hi, I don't see any mistake in the code you've provided, did you check the generated code and see if the signal is defined in there?
    There should be file with the name moc_mywidget.cpp in your build folder.

    Edit: wait your linker error is a little weird, it said "DragWidgetCible::enableProcess(int)", where is that class DragWidgetCible coming from I thought you have defined the signal in MyWidget?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.