我有:
-在Windows 7/32位上安装了Cygwin 1.7.25
-g++ --version --> g++ (GCC) 4.8.2
-libstdc++.a --> gcc-g++-4.8.2-1
尝试编写一个C++的Hello World程序:
#include <string>
int main()
{
std::string s = "123";
int i = std::stoi(s);
}
编译产生如下结果:
$ g++ -std=c++11 main.cpp
main.cpp: In function ‘int main()’:
main.cpp:6:10: error: ‘stoi’ is not a member of ‘std’
int i = std::stoi(s);
我搜索了几个小时,但仍然找不到解决方案。这里出了什么问题?