无法解析std :: to_string()

时间:2015-10-20 18:36:39

标签: c++ c++11

我有错误“函数'to_string'无法解析”尽管其他C ++ 11表达式正确运行。我在Linux Mint上使用Eclipse Mars CDT和GCC-C ++ 4.9。

#include <iostream>
#include <string>

using std::string;

int main()
{
    int a = 123;
    string str = std::to_string(a);
}

是的,我使用-std = c ++ 11,__ GXX_EXPERIMANTAL_CXX0X__,以及-std = c ++ 0x。

1 个答案:

答案 0 :(得分:1)

您很可能忘记#include <string>或忘记指定名称空间std::