没有成员在命名空间std中命名为stoi [英] No Member named stoi in namespace std

查看:1365
本文介绍了没有成员在命名空间std中命名为stoi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试下面链接中的 std :: stoi 函数:
http://en.cppreference.com/w/cpp/string/basic_string/stol

但我得到了错误:

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:


没有成员在命名空间std中命名为stoi。

No Member named stoi in namespace std.

我该怎么办?
请提供谢谢。

What should I do? Please advise thanks.

PS:我使用Xcode Ide来做我的c ++。

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 << '\n';
}

图片

推荐答案

首先,你需要一个支持C ++ 11的编译器,你需要在C ++ 11模式下编译(在某些情况下)。

First of all, you need a compiler that supports C++11 and you need to compile in "C++11 mode" (in some cases).

其次,如果这实际上是一个 intellisense 问题(看起来它可能是),那么可能只是你的IDE不支持C ++ 11。

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆