简单的测试代码:
#include <string>
#include <iostream>
using namespace std;
int main() {
string a = "12345abc";
int b = stoi(a);
cout << b << endl;
}
已经开启c++11但是编译器还是报错. gcc版本是4.9.x.
错误信息:
mingw32-g++.exe -Wall -g -std=c++11 -c F:\CodeBlocks\test\Untitled1.cpp -o obj\Debug\Untitled1.o
F:\CodeBlocks\test\Untitled1.cpp: In function 'int main()':
F:\CodeBlocks\test\Untitled1.cpp:7:20: error: 'stoi' was not declared in this scope
感谢解答
#include <string>
#include <iostream>
using namespace std;
int main() {
string a = "12345abc";
int b = stoi(a);
cout << b << endl;
}
已经开启c++11但是编译器还是报错. gcc版本是4.9.x.
错误信息:
mingw32-g++.exe -Wall -g -std=c++11 -c F:\CodeBlocks\test\Untitled1.cpp -o obj\Debug\Untitled1.o
F:\CodeBlocks\test\Untitled1.cpp: In function 'int main()':
F:\CodeBlocks\test\Untitled1.cpp:7:20: error: 'stoi' was not declared in this scope
感谢解答