2015-10-20 87 views
-5

我有错误“Function”to_string'clould not be resolved“,尽管其他C++ 11表达式正常运行。我在Linux Mint上使用Eclipse Mars CDT和GCC-C++ 4.9。std :: to_string()无法解析

#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。

+3

你有没有'#包括'和'用-std = C++编译11'? – NathanOliver

+0

对不起,我粘贴了错误的代码。 –

+1

欢迎来到Stack Overflow! '使用std :: string'后冒号是什么?请** [编辑] **您的问题与[mcve]或[SSCCE(Short,Self Contained,Correct Example)](http://sscce.org) – NathanOliver

回答

1

这极有可能是你忘了#include <string>或者你忘了指定的命名空间std::

+1

这是非常喜欢,我们不能告诉所提供的信息。他们不能使用C++ 11,这也会导致这个问题。 – NathanOliver

+0

@NathanOliver它是至少标记为c + + 11,并在其他C++ 11表达式正在工作的问题中指定 –

+1

是它被标记为C++ 11,但如果它们没有用'-std = C++ 11'编译,那么这将是答案,你的答案会是错误的。 – NathanOliver

相关问题