[solved] undefined reference to QWidget::styleChange



  • I know that this problem was reported in the past and some solutions were proposed but none of them work for me.
    My enviroment is:
    Qt5.3 for raspberry cross compiled, from the git repository
    Linaro cross compiler.

    I have a library that has a dialog with some widgets, buttoms, frames, etc.
    The library itself compiles fine also for desktop and RPi.

    When the app that uses the library is compiled to desktop system there is no problem but when it is compiled for RPi system I get messages of undefined reference to several methods of QWidget:

    ../libQConfigDialog.so: undefined reference to QWidget::styleChange(QStyle&)' ../libQConfigDialog.so: undefined reference toQWidget::windowActivationChange(bool)'
    ../libQConfigDialog.so: undefined reference to QWidget::fontChange(QFont const&)' ../libQConfigDialog.so: undefined reference toQWidget::enabledChange(bool)'
    ../libQConfigDialog.so: undefined reference to QWidget::paletteChange(QPalette const&)' ../libQConfigDialog.so: undefined reference toQWidget::languageChange()'

    The main program has also some dialogs and when this library is removed it compiles and works fine in the RPi.

    The .pro of the library is:

    @
    TEMPLATE = lib
    TARGET = QConfigDialog
    QT += core
    gui
    widgets

    HEADERS += treemodel.h
    treeitem.h
    qconfigdialog.h
    SOURCES += treemodel.cpp
    treeitem.cpp
    qconfigdialog.cpp
    FORMS += qconfigdialog.ui
    RESOURCES +=
    INCLUDEPATH +=
    @

    And the .pro of the app is:

    @
    QT += core gui widgets

    TARGET = QtAppSample
    TEMPLATE = app

    SOURCES += main.cpp
    QtAppSampleDlg.cpp

    HEADERS += QtAppSampleDlg.h

    FORMS += qtappsampledlg.ui

    LIBS += -L../
    -lQConfigDialog
    @

    Has anyone an idea about what is happening?

    Thanks.
    Jorge

    [edit: Added missing coding tags @ SGaist]


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    All the functions missing are coming from Qt 3. Are you building an old application ? In any case have a look at the "Porting to Qt 4" chapter of Qt's documentation



  • Thanks for your response,

    I'll review that. The library was developed with Qt4 but what I don't understand is why the errors appears because I don't do any call to this methods and they aren't present in the moc file so should I suppose that is an internal dependance in the Qt?

    I'm thinking in generate again the dialog whit the last version of Qtcreator, the original was developed with Qtcreatod 2.8


  • Lifetime Qt Champion

    If the library was built with a Qt 4 version compiled with qt3-support enabled then it's normal that you get these missing symbol if you try to link to a different version.

    Anyway, since you are using Qt 5, you should rebuild this library. The Qt Creator version doesn't matter



  • I finally solved it creating a new project with qtcreator, copying the logic code and redesigning the interface.
    The main difference I found rewriting the interface was that I previously acceded to the widgets with ui.whateverwidget and now I have to put ui->whateverwidget.

    Thanks for your help.


  • Lifetime Qt Champion

    ui. vs ui-> is an implementation detail that should have no influence on the problem you had.

    Anyway, nice you found a solution.

    Since it's working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

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