我的代码是这样的:
#include <string>
int main()
{
for (int i = 0; i < 3; i++)
{
std::string flag = "I got a number like : " + std::to_string(i);
}
}
当我尝试在我的 FreeBSD 9.2 机器上使用 g++ 4.8.2 编译它时,我收到以下错误:
error: 'to_string' is not a member of 'std'
std::string flag = "I got a number like : " + std::to_string(i);
是的,我正在使用-std=c++11
,不,我没有使用 minGW
编译行:g++48 -g -std=c++11 -Wall -O2 -m32 -pipe -fexceptions -D_THREAD_SAFE -DNDEBUG -mtune=i686 -fstack-protector-all