No Member named stoi in namespace std(命名空间 std 中没有名为 stoi 的成员)
问题描述
我正在测试以下链接中的 std::stoi
函数:http://en.cppreference.com/w/cpp/string/basic_string/stol
但我得到了错误:
命名空间 std 中没有名为 stoi 的成员.
我该怎么办?请指教谢谢.
P.S:我使用 Xcode Ide 来做我的 C++.
#include #include <字符串>int main() {std::string 测试 = "45";int myint = std::stoi(test);std::cout <<myint <<'
';}
图片
首先,你需要一个支持 C++11 的编译器,并且需要在C++11 模式"下进行编译(在某些情况下).
其次,如果这实际上是 intellisense 问题(看起来可能是),那么可能只是您的 IDE 尚不支持 C++11.>
I am testing out std::stoi
function found in the link below:
http://en.cppreference.com/w/cpp/string/basic_string/stol
but I got the error:
No Member named stoi in namespace std.
What should I do? Please advise thanks.
P.S: I am using Xcode Ide to do my c++.
#include <iostream>
#include <string>
int main() {
std::string test = "45";
int myint = std::stoi(test);
std::cout << myint << '
';
}
Image
First of all, you need a compiler that supports C++11 and you need to compile in "C++11 mode" (in some cases).
Secondly, if this is in fact an intellisense issue (and it looks like it may be), then it could simply be that your IDE doesn't support C++11 yet.
这篇关于命名空间 std 中没有名为 stoi 的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:命名空间 std 中没有名为 stoi 的成员


基础教程推荐
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 常量变量在标题中不起作用 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01