c++ - to_string不存在问题
本文介绍了c++ - to_string不存在问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
提示:
D:C programLightOjmain.cpp|8|error: 'to_string' is not a member of
'std'|
这是代码:
// to_string example
#include <iostream> // std::cout
#include <string> // std::string, std::to_string
int main ()
{
std::string pi = "pi is " + std::to_string(3.1415926);
std::string perfect = std::to_string(1+2+4+7+14) + " is a perfect number";
std::cout << pi << '\n';
std::cout << perfect << '\n';
return 0;
}
IDE是code::blocks,请问这个是为什么呢?
解决方案
检查你的编译器版本,看是否支持c++11特性,是否支持这个新的标准库函数
这篇关于c++ - to_string不存在问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文