Congratulations to our 2022 Qt Champions!

Qt Remote Objects Compiler POD results in linker error

  • Hi all,

    my project has the following hierarchy:

    • Client
    • Common (regular app project (no aux) because otherwise it wont generate the *_replica and *_source files
      • Contains share libs and *.rep files
    • Server

    For the last month working with remote objects was greate but now I must synchronise a list of active users with custom members like username, profile picture etc. As stated in the documentation one should use the POD (Plain old data) for this, but generating even a simple example:

    #include <QString>
    #include <QList>
    POD Test(QList<QString> user)
    class ActiveSessionsList

    Results in:

    LNK2005: "public: static struct QMetaObject const Test::staticMetaObject [...] is already in moc_rep_activeSessionsList.obj defined (from moc_rep_activeSessionsList_source.obj)

    Any ideas?
    Compiled with Qt 5.12.0 MSVC2017 Windows 10

  • I now replaced the generation of REP files from the common project to a custom bat file which calls the compiler for all the Remote Objects. Because the staticMetaObject must be registered in the client and the server the error message makes sense because it will register both inside the same common project...

Log in to reply