Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.6.1, 6.8.0
Description
If invokable function has QHash<int, QByteArray>, it will cause linker error if header of any other QObject class includes a Remote Objects header because QIntHash in qtremoteobjects/src/remoteobjects/qtremoteobjectglobal.h:52 is not exported.
typedef QHash<int, QByteArray> QIntHash; ..... QT_DECL_METATYPE_EXTERN(QIntHash, /* not exported */)
This happens because CMake includes all moc'd files in generated mocs_compilation.cpp and that then puts everything in the same translation unit. It will cause:
/usr/bin/ld: CMakeFiles/quickcmake.dir/quickcmake_autogen/mocs_compilation.cpp.o: in function `int qRegisterNormalizedMetaType<QHash<int, QByteArray> >(QByteArray const&)': /home/user/Qt/6.6.1/gcc_64/include/QtRemoteObjects/qtremoteobjectglobal.h:57: undefined reference to `qRegisterNormalizedMetaType_QIntHash(QByteArray const&)' collect2: error: ld returned 1 exit status
To reproduce try to build attached example.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-121738 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
554595,1 | WIP: Fix link error when using an invokable method with QHash<int,QByteArray> and Remote Objects | dev | qt/qtremoteobjects | Status: DEFERRED | -2 | +1 |