2015-10-20 85 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

相關問題