【发布时间】:2013-10-07 23:45:35
【问题描述】:
好的,我有
tmp.cpp:
#include <string>
int main()
{
std::to_string(0);
return 0;
}
但是当我尝试编译时,我得到:
$ g++ tmp.cpp -o tmp
tmp.cpp: In function ‘int main()’:
tmp.cpp:5:5: error: ‘to_string’ is not a member of ‘std’
std::to_string(0);
^
我正在运行 g++ 版本 4.8.1。与我在那里发现的所有其他对该错误的引用不同,我不使用 MinGW,我使用的是 Linux (3.11.2)。
任何想法为什么会发生这种情况?这是标准行为,我做错了什么还是某处有错误?
【问题讨论】:
-
使用
g++ -std=c++11 -o tmp tmp.cc,我得到`error: 'to_string' is not a member of 'std'。 g++ 版本是 4.8.2 。这是回归吗? -
嗯,不确定,但它适用于 g++ 4.9.0
-
gcc --version 使用 gcc tdm-2 4.8.1,使用 -std=c++11 编译仍然会产生错误 'to-string' is not member of std
-
对我来说也一样。使用
arm-none-eabi-gcc -std=c++11我仍然收到错误消息。
标签: c++ linux string c++11 g++