当我尝试使用std :: stoi并尝试编译时,我收到错误消息“stoi不是std的成员”.我从命令行使用g 4.7.2,所以它不能是IDE错误,我有我的所有包含在顺序,而g 4.7.2默认使用c 11.如果有帮助,我的操作系统是Ubuntu 12.10.有没有我没有配置的东西?
#include <iostream> #include <string> using namespace std; int main(){ string theAnswer = "42"; int ans = std::stoi(theAnswer,10); cout << "The answer to everything is " << ans << endl; }
不会编译但没有任何错误.
解决方法
原文地址:https://www.jb51.cc/c/114297.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。