C++ stod was not declared解决方法
C++ stod was not declared
#include <iostream>
#include <stdlib.h>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
string s = "fed3.14d";
string tmp = "+-.0123456789";
int d = 0;
d = stod(s.substr(s.find_first_of(tmp)));
cout << d;
system("pause");
return 0;
}
error:"stod" was not delcared in this scope
注:使用工具为codeblocks 13.12, 编译器为GUN GCC COMPLIER 已勾选have g++ follow the C++11 ISO C++ language standard
请问问题出在哪里呢?知道stod是C++11的新标准 但是还是有问题啊!!!
------解决思路----------------------
应该是,我没试过,楼主用atoi、atof代替吧
#include <iostream>
#include <stdlib.h>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
string s = "fed3.14d";
string tmp = "+-.0123456789";
int d = 0;
d = stod(s.substr(s.find_first_of(tmp)));
cout << d;
system("pause");
return 0;
}
error:"stod" was not delcared in this scope
注:使用工具为codeblocks 13.12, 编译器为GUN GCC COMPLIER 已勾选have g++ follow the C++11 ISO C++ language standard
请问问题出在哪里呢?知道stod是C++11的新标准 但是还是有问题啊!!!
------解决思路----------------------
应该是,我没试过,楼主用atoi、atof代替吧