'Stof' function cannot be resolved

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

+5
2

stof . MinGW gcc 4.7.2. gcc 4.8. SO . . , , , .

+6

stof - ++ 11. , ( ++ 11, ).

g++, , -std=c++11 (std=c++0x pre g++ - 4.7).

g++, , g++ -v - (, , 4.2), ++ 11 .

+7

All Articles