I had this problem before, but I found a job, but this time, work is not an option.
I try to use the stof function, but I get errors: 'stof' is not a member of 'std' The function stof cannot be resolved.
I use it for sure if it shows on this page: http://www.cplusplus.com/reference/string/stof/
And here are my included:
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
So what am I doing wrong? And if a solution cannot be found, can someone point me to another way to convert the string to float and make it throw an exception if the string is incompatible?
EDIT: update by program and program errors.
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main()
{
string testString = "";
float testFloat = 0.0;
testFloat = std::stof(testString);
return 0;
}
I get the following errors:
'stof' 'std' main.cpp/Assignment/src line 33 C/++
'stof' main.cpp/Assignment/src line 33