i am migrating my project from vc6 to vs2010. while compiling i get an error at line

TMemPool<T>::TTag* that error C2143: syntax error : missing ';' before '*' along with error C4430: missing type specifier - int assumed. Note: C++ does not support default-int.

can any one help me with this. i am sorry if i asked a dumb question. But i need help as i am not so good with coding.

Also if possible can you please tell me any pre-required settings needed to be done while migrating my project from VC 6 to VS 2010. Plus is there any steps required to perform before migrating the code.

please find the line of code here for error. let me know if you need anything else.

thanks in advance.

// ----------------------------------------------------------------------------
template <class T>
TMemPool<T>::TTag*
TMemPool<T>::GetAt
(
int I_Index
)
{
if(I_Index < 0 || (unsigned int)I_Index > GetTotal())
    return NULL;
return &m_pStorage[I_Index].m_Tag;
}

#endif // !defined(AFX_TMEMPOOL_H__825D671F_49E6_46C1_AB3D_79920EF692D8__INCLUDED_)
有帮助吗?

解决方案

What type is TTag?

Try this

template <class T>
typename TMemPool<T>::TTag* TMemPool<T>::GetAt(int I_Index)
{
    if(I_Index < 0 || (unsigned int)I_Index > GetTotal())
        return NULL;
    return &m_pStorage[I_Index].m_Tag;
}

IIRC, VC6 used to compile stuff where typename was missing, but VC7 onwards, that changed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top