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

Error using include method with nzmqt: undefined reference to 'vtable for nzmqt::ZMQcontext'



  • I'm using Qt Creator 4.8.2 on ubuntu 16.04 with nzmqt 3.2.1 and 0mq 4.1.4-7.

    https://github.com/jonnydee/nzmqt

    I've started using nzmqt for use with my console application. I have been able to download the nzmqt code from github. They have excellent support for Qt with several .pro files for different uses including testing. I have been able to open all of their .pro file and successfully build and run them. All of the unit tests pass.

    Now, I'm trying to use the "include" method of working with their code. I have set up my .pro file and the compilation phase passes successfully. But, the linker gives errors:

    /home/inplant/scannerRD/builds/debug/InPlantScanner/IPSconsole/moc_ipsconsoleapp.o:-1: In function `nzmqt::ZMQContext::ZMQContext(QObject*, int)':
    
    /home/inplant/scannerRD/nzmqt/include/nzmqt/impl.hpp:355: error: undefined reference to `vtable for nzmqt::ZMQContext'
    
    
    /home/inplant/scannerRD/nzmqt/include/nzmqt/impl.hpp:359: error: undefined reference to `vtable for nzmqt::ZMQContext'
    
    /home/inplant/scannerRD/builds/debug/InPlantScanner/IPSconsole/moc_ipsconsoleapp.o:-1: In function `nzmqt::PollingZMQContext::PollingZMQContext(QObject*, int)':
    
    /home/inplant/scannerRD/nzmqt/include/nzmqt/impl.hpp:440: error: undefined reference to `vtable for nzmqt::PollingZMQContext'
    
    /home/inplant/scannerRD/nzmqt/include/nzmqt/impl.hpp:440: error: undefined reference to `vtable for nzmqt::PollingZMQContext'
    
    error: collect2: error: ld returned 1 exit status
    

    I have seen similar issues in other projects I have developed (not using nzmqt) and have been able to resolve the issues by ensuring that I have destructors defined for all my classes. I have checked the nzmqt classes and they have destructors and also the Q_OBJECT macro.

    Do you have any suggestions on what I might look at to resolve this?

    (Note: This relates to a post on the nzmqt issues site: https://github.com/jonnydee/nzmqt/issues/51 )



  • I switched to the static library method and it seems to be working with that.


Log in to reply