Qt qRegisterMetaType用法
为什么会出现此错误?Qt qRegisterMetaType用法,qt,Qt,为什么会出现此错误?int-metatype\u id=qRegisterMetaType(“IntList”); error C2059: syntax error : 'string' warning C4667: 'int qRegisterMetaType(void)' : no function template defined that matches forced instantiation 您需要添加Q\u DECLARE\u元类型(IntList),然后才能注册它。“qR
int-metatype\u id=qRegisterMetaType(“IntList”);
error C2059: syntax error : 'string'
warning C4667: 'int qRegisterMetaType(void)' : no function template defined that matches forced instantiation
您需要添加Q\u DECLARE\u元类型(IntList)
,然后才能注册它。“qRegisterMetaType”是一个函数。它必须出现在代码块中。我正在头文件中声明这些类型。当我在函数中声明相同的内容时,比如main()。我没有得到这个编译错误。
template int qRegisterMetaType<IntList>("IntList");
error C2059: syntax error : 'string'
warning C4667: 'int qRegisterMetaType(void)' : no function template defined that matches forced instantiation
int metatype_id = qRegisterMetaType<IntList>("IntList");