QtDBus linkage error



  • Hi,
    I built Qt on Windows with WinDBus. Qt itself built OK, but QDbus examples build fails with message

    moc_car_adaptor_p.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QDBusAbstractAdaptor::staticMetaObject" (?staticMetaObject@QDBusAbstractAdaptor@@2UQMetaObject@@B)

    Folder E:\qt\4.6.4\msvc2008\lib contains QtDBus4.dll QtDBus4.lib QtDBusd4.dll and QtDBusd4.lib. All contains 'staticMetaObject@QDBusAbstractAdaptor@@2UQMetaObject@@B' string.

    How to fix it?

    Beforehand thankful, Ilya.



  • The problem was in qdbusmacros.h:
    @#if defined(QDBUS_MAKEDLL)

    define QDBUS_EXPORT Q_DECL_EXPORT

    #elif defined(QT_SHARED)

    define QDBUS_EXPORT Q_DECL_IMPORT

    #else

    define QDBUS_EXPORT

    #endif
    @

    QT_SHARED was not declared in application, and QDBUS_EXPORT becames nothing.

    Adding
    @CONFIG += QT_SHARED

    @

    solved the problem.

    Note: in Qt 4.8.4 all works fine (previously I used 4.6.4)


Log in to reply
 

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