错误:
error: ‘to_string’ was not declared in this scope
原因:
to_string是C++11引入的新功能,旧版本编译器可能不支持它,所以要给编译器加上“C++11”编译支持
解决方案:
Linux下的GCC编译器:在 g++ 命令行加入编译选项 -std=c++11,例如:
g++ -o test test.cpp -std=c++11
CodeBlocks编译器:工具栏打开Settings->Compiler,在这里勾选C++11标准即可。(参考链接)

Dev C++ 编译器:在菜单栏点开Tools -> Compile Options,加上圈住的编译指令即可让编译器支持c++11的标准。(参考链接)

转载于:https://www.cnblogs.com/sylar5/p/9797057.html
最后
以上就是潇洒小丸子最近收集整理的关于error: ‘to_string’ was not declared in this scope的全部内容,更多相关error:内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复