Reputation: 933
When I compile my code,I got this error
and my code is
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
string str,str2;
cin>>str>>str2;
float a,b;
a = stof(str); //error
b = stof(str2); //error
cout<<a+b;
return 0;
}
how to resolve this ??
Upvotes: 1
Views: 15000
Reputation: 1
With dev c++ you need to go to Project > Project Options (Ctrl +h) > Compiler > Code generation > Language standard and select GNU C++ 11
(Not too sure about the menu since i have the language set to italian but it's pretty much that)
Upvotes: 0
Reputation: 121
Also std::stof
can only be compiled using c++11 version for which compilation should be done as:
g++ -std=c++11 code.cc
Upvotes: 4