Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]QVariant passed in SIGNAL LNK 2019 Unresolved External Symbol
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QVariant passed in SIGNAL LNK 2019 Unresolved External Symbol

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    doozii
    wrote on last edited by
    #1

    Still really new to QT development

    Not entirely sure why I am seeing the linker error:

    debug\myproject.exe : fatal error LNK1120: 1 unresolved externals
    jom: C:\Qt\build-myproject-Desktop_Qt_5_2_1_MSVC2012_OpenGL_64bit-Debug\Makefile.Debug [debug\myproject.exe] Error 1120
    jom: C:\Qt\build-myproject-Desktop_Qt_5_2_1_MSVC2012_OpenGL_64bit-Debug\Makefile [debug] Error 2
    10:55:42: The process "C:\Qt\Qt5.2.1\Tools\QtCreator\bin\jom.exe" exited with code 2.
    Error while building/deploying project myproject(kit: Desktop Qt 5.2.1 MSVC2012 OpenGL 64bit)
    When executing step 'Make'
    10:55:42: Elapsed time: 00:04.

    Here's what I did...

    Here's some code:
    @MyConsumerClass:

    signals:
    void configValueChanged(QVariant val);

    MyProducerClass:

    public slots:
    void configValueChangeHandler(QVariant val);@

    I added @#include <QVariant>@ to both classes and tried to build. That's when I saw the error. Using QT Creator 5.2.1 on Windows 7.

    I also noticed that if I move the method from the public slots: to be just a public regular method, I can compile just fine. But I am hoping to be able to use SIGNALS to pass data around so I can avoid coupling.

    Can QVariant not be used as a signal argument??

    Thank you for any guidance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Sure they can, did you implement configValueChangeHandler ?

      If so, you would need to post what exact symbols are missing

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        doozii
        wrote on last edited by
        #3

        I did:

        @void configValueChangedHandler(QVariant val){
        ...
        }
        @

        How do I see what exact symbols are missing. Those two messages are all Im getting in the compile and issues windows:

        moc_myclass.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl MyClass::configValueChangedHandler(class QVariant)" (?configValueChangedHandler@MyClass@@QEAAXVQVariant@@@Z) referenced in function "private: static void __cdecl MyClass::qt_static_metacall(class QObject *,enum QMetaObject::Call,int,void * *)" (?qt_static_metacall@MyClass@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z)

        When I try to make the implementation public (like the slot accessor), I get a different error... so this :
        @public void configValueChangedHandler(QVariant val){
        ...
        }
        @
        doesnt work.

        Ive been away from c++ for about a decade (please forgive my ignorance).

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Are you missing the Q_OBJECT macro in your class ? Does it properly inherit from QObject ?

          If the macro is missing, don't forget to re-run qmake before compiling

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            doozii
            wrote on last edited by
            #5

            nope... its there

            1 Reply Last reply
            0
            • D Offline
              D Offline
              doozii
              wrote on last edited by
              #6

              Q_OBJECT is intact. Ive run clean, qmake and build. Is there something perhaps I have to reference like a kit or something? The only current kit I have is Desktop Qt 5.2.1 MSVC2012 OpenGL 64bit

              1 Reply Last reply
              0
              • D Offline
                D Offline
                doozii
                wrote on last edited by
                #7

                well, im a complete idiot... I figured it out. it wasnt the QVariant at all. I didnt prepend my classname before my method. Not used to having to do that. Its working now. Thanks!!!

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved