Type argument of Q_DECLARE_METATYPE(T*) must be fully defined
-
In main thread, I created another subthread, and the struct must be transfered to the subthread. Here is my Connect in the main thread:
HeartThreadMsg::HeartThreadRequest threadReqMsg; threadReqMsg.set_ack_identity(1); qRegisterMetaType<HeartThreadMsg::HeartThreadRequest>("HeartThreadMsg::HeartThreadRequest"); qRegisterMetaType<struct CDK::RRFramework>("struct CDK::RRFramework"); emit operSig(m_RRFW, threadReqMsg);
m_RRFW is a struct, but it is not fully defined, it defined like this:
namespace CDK { struct RRFramework; }
when I compile the application, it shows that Type argument of Q_DECLARE_METATYPE(T*) must be fully defined, if I do want to declare the struct, and the struct can not be fully defined, does anyone know how to solve this, or does there has other method?
-
Hi,
To add to @jsulm, you should use the version of qRegisterMetaType without argument. The one you are using is useful only for registering alias types.
-
@sanojsubran said in Type argument of Q_DECLARE_METATYPE(T*) must be fully defined:
Do you mean in the header, where the struct is defined?
Somewhere in your code where the definition of the struct is known.