可能重复:
std::to_string - more than instance of overloaded function matches the argument list
#include <string>
int main()
{
double randDouble = 1245.432;
std::wstring stringDouble = std::to_wstring(randDouble);
}
当我在Visual Studio 2010中编译它时,我收到此错误
错误1错误C2668:'std :: to_wstring':对重载的模糊调用 功能6
1&GT;错误C2668: 'std :: to_string':对重载函数的模糊调用
1&GT; d:\ program files(x86)\ microsoft visual studio 10.0 \ vc \ include \ string(688):可能是'std :: string std :: to_string(long double)'
1&GT; d:\ program files(x86)\ microsoft visual studio 10.0 \ vc \ include \ string(680):或'std :: string std :: to_string(_ULonglong)'
1&GT; d:\ program files (x86)\ microsoft visual studio 10.0 \ vc \ include \ string(672):或
'std :: string std :: to_string(_Longlong)'
有人可以向我解释为什么编译器会混淆,我做错了什么?
答案 0 :(得分:6)
这是Visual C ++ 2010中的一个错误。它已在Visual C ++ 2012中修复。