Problem Compiling Widget application, Linux



  • Hi,

    I have problems linking a widgets application. The error I get looks like this:

    CMakeFiles/test/src/moc_TestClass.cpp.o:(.data.rel.ro._ZTV28TestClass[_ZTV28TestClass]+0x218): undefined reference to `non-virtual thunk to QWidget::redirected(QPoint*) const'
    CMakeFiles/test/src/moc_TestClass.cpp.o:(.data.rel.ro._ZTV28TestClass[_ZTV28TestClass]+0x220): undefined reference to `non-virtual thunk to QWidget::sharedPainter() const'
    CMakeFiles/test/src/moc_TestClass.cpp.o:(.data.rel.ro._ZTI28TestClass[_ZTI28TestClass]+0x10): undefined reference to `typeinfo for QDialog'
    libs/libmylib.a(mylib.cpp.o): In function `mylib_init':
    mylib.cpp:(.text+0x4b): undefined reference to `QApplication::QApplication(int&, char**, int)'
    collect2: error: ld returned 1 exit status
    

    I have no idea what is going on. In target_link_libraries I have the packages:

    target_link_libraries(  ${PROJECT_NAME}
      ${ADDITIONAL_LIBRARIES}
      ${QWT_LIBRARY}
      Qt5::Core
      Qt5::Widgets
      Qt5::Svg
    

    what is going wrong?


  • Qt Champions 2018

    @maxwell31 said in Problem Compiling Widget application, Linux:

    QApplication::QApplication(int&, char**, int)

    This is a Qt4 ctor: https://doc.qt.io/archives/qt-4.8/qapplication.html#QApplication-3

    Looks like you're picking up the Qt4 include files.


Log in to reply
 

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