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.