2

可能重复:
std::to_string - 多个重载函数的实例与参数列表匹配

#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> 错误 C2668: 'std::to_string' : 对重载函数的模糊调用

1> d:\program files (x86)\microsoft visual studio 10.0\vc\include\string(688): 可能是 'std::string std::to_string(long double)'

1> d:\program files (x86)\microsoft visual studio 10.0\vc\include\string(680): 或 'std::string std::to_string(_ULonglong)'

1> d:\program files (x86)\microsoft visual studio 10.0\vc\include\string(672): 或
'std::string std::to_string(_Longlong)'

有人可以向我解释为什么编译器会感到困惑,我在做什么错吗?

4

1 回答 1

6

这是 Visual C++ 2010 中的一个错误。它已在 Visual C++ 2012 中修复。

于 2013-01-27T01:15:31.607 回答