<分区>
我已经能够找到很多关于此的问题,但似乎所有问题都表明如果您使用 -std=c++11 进行编译,它应该可以与 gcc 4.8.1 一起使用
这是我的 g++ --version 输出:
g++ (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
然而,当我尝试使用 std::tostring 编译一些东西时,即使是像这样的简单命令:
g++ -O0 -g3 -Wall -c -fmessage-length=0 -std=c++11 -o "Main.o" "Main.cpp"
我收到以下错误:
Main.cpp: In function 'int main()':
Main.cpp:6:26: error: 'to_string' is not a member of 'std'
std::string intString = std::to_string(1335);
即使是像这样简单的文件:
#include <string>
#include <cstdio>
int main()
{
std::string intString = std::to_string(1335);
printf(intString.c_str());
return 0;
}
有什么想法吗?这是在 Windows 7 64 位上使用最新版本的 MinGW。