qRegisterMetaType usage

qt

Solution

"qRegisterMetaType" is a function. It must appear in a code block.

Problem

``` #include<QMetaType> typedef QList<int> IntList; qRegisterMetaType<IntList>("IntList"); error C2909: 'qRegisterMetaType': explicit instantiation of function template requires return type ``` C2909 says I need to define ``` template int qRegisterMetaType<IntList>("IntList"); ``` If I define like I mentioned above then I get the below error ``` error C2059: syntax error : 'string' warning C4667: 'int qRegisterMetaType(void)' : no function template defined that matches forced instantiation ``` why do I get this error ?

Original source