stoi()代码块不起作用 [英] stoi() CodeBlocks not working
问题描述
我正在使用代码块,并且无法使 stoi()
函数起作用。我还阅读了有关此问题的其他问题,但无法解决。我检查了C + 11,我使用的是命名空间std,并且具有字符串标头。我不知道该如何解决这个问题。
I am using codeblocks and i can't make stoi()
function work. I read other questions regarding this issue but I couldn't solve it. I checked C+11, I am using namespace std and I have the string header. I don't know how can I solve this problem.
error: 'stoi' was not declared in this scope
推荐答案
找到了几乎相同问题的答案在这里:
found the answer on almost the same question here:
看来您的MinGW需要补丁了: 在MinGW中启用字符串转换功能
通过此链接,您可以下载.zip,然后按照说明进行下载。
From this link you can download a .zip, than follow the instructions.
此修补程序启用以下列表: std名称空间中的C ++ 11函数和
模板:
This patch enables the following list of C++11 functions and templates in the std namespace:
stoi, stol, stoul, stoll, stof, stod, stold, to_string, to_wstring
注意,也许您会使用复制/粘贴后出现更高版本的错误:
Attention, maybe you will haver errors with later versions, after using the copy/paste:
人们应注意,不能保证直接直接替换文件是安全的在MinGW GCC 4.7以后的版本上-使用pastebin片段,打开文件,并注释/添加到现有文件。这样应用,在MinGW GCC 4.8.1 afai上仍然可以正常使用
"People should note that direct replacement of the files is not guaranteed to be safe on versions later than MinGW GCC 4.7 - use the pastebin snippets, open the files, and comment/add to the existing files. Applied as such, this still works fine on MinGW GCC 4.8.1 afai"
这篇关于stoi()代码块不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!