错误信息:‘to_string’ is not a member of ‘std’
作者:BlogUpdater |
时间:2018-04-18 |
浏览:7428 |
评论已关闭 条评论
问题程序
#include <string>
int main()
{
std::to_string(0);
return 0;
}
编译指令
# g++ main.cpp -o test
报告错误
error: ‘to_string’ is not a member of ‘std’
解决方法
添加-std=c++11 选项,如下所示
# g++ -std=c++11 main.cpp –o test
问题原因
to_string在新版本的C++11中才被支持,所以,这里在编译的时候添加了C++11的支持选项。
如需转载,请注明来自:拓扑梅尔智慧办公平台 | TopomelBox 官方站点
相关推荐
- vcpkg更新及产品路线图
- Posted on 05月05日
- 构建吞吐量系列之模板元编程基础
- Posted on 01月16日
- 第 566 期:微软确认现在可以无限期暂停 Windows 11 更新
- Posted on 03月21日
- 第 438 期:微软发布 Windows 10 扩展安全更新 KB5073724
- Posted on 01月15日



评论已关闭。