error C2664 in VS2005 VC++
-
std::list < xlong > ClientConfig:: GetHistory(int id) { .... doing something .... return 0; } When the above code is compailed in VS 2005 (VC++), following is the error error C2664: 'stlp_std::list<_Tp>::list(const stlp_std::list<_Tp> &)' : cannot convert parameter 1 from 'int' to 'const stlp_std::list<_Tp> &' with [ _Tp=xlong ] Reason: cannot convert from 'int' to 'const stlp_std::list<_Tp>' with [ _Tp=xlong ] Constructor for class 'stlp_std::list<_Tp>' is declared 'explicit' with [ _Tp=xlong ] resdata.cpp I tried to return xlong value, but still getting the same error Can any once help to fix the same
-
std::list < xlong > ClientConfig:: GetHistory(int id) { .... doing something .... return 0; } When the above code is compailed in VS 2005 (VC++), following is the error error C2664: 'stlp_std::list<_Tp>::list(const stlp_std::list<_Tp> &)' : cannot convert parameter 1 from 'int' to 'const stlp_std::list<_Tp> &' with [ _Tp=xlong ] Reason: cannot convert from 'int' to 'const stlp_std::list<_Tp>' with [ _Tp=xlong ] Constructor for class 'stlp_std::list<_Tp>' is declared 'explicit' with [ _Tp=xlong ] resdata.cpp I tried to return xlong value, but still getting the same error Can any once help to fix the same
Look at what the function is supposed to return (a std::list) and look at what you are actually returning (an integer). IF you want this to work, you either have to change the return type to long or return a std::list object form your function.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++