Type argument of Q_DECLARE_METATYPE(T*) must be fully defined
-
wrote on 27 Sept 2017, 02:12 last edited by
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?
-
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?
@Ania You need to call qRegisterMetaType somewhere where the struct is fully defined.
-
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.
-
wrote on 9 Jan 2019, 09:20 last edited by
@jsulm Do you mean in the header, where the struct is defined?
I am also facing the same issue. Any help would be appreciated.
-
@jsulm Do you mean in the header, where the struct is defined?
I am also facing the same issue. Any help would be appreciated.
@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.
-
To add to @jsulm, it's pretty usual to have that macro at the bottom of the header where the class/struct is defined.