gpt4 book ai didi

qt - qRegisterMetaType 用法

转载 作者:行者123 更新时间:2023-12-04 02:00:07 26 4
gpt4 key购买 nike

  #include<QMetaType>

typedef QList<int> IntList;

qRegisterMetaType<IntList>("IntList");


error C2909: 'qRegisterMetaType': explicit instantiation of function template requires return type

C2909 说我需要定义
 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");

关于qt - qRegisterMetaType 用法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11679435/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com