Thursday, 15 July 2010

c++ - MinGW g++ cannot find std::stof -



c++ - MinGW g++ cannot find std::stof -

i (re)installed mingw scratch, gcc 4.8.1 (the latest available), , next programme won't compile:

#include <iostream> #include <string> int main() { float f; std::string s = "5.235"; f = std::stof(s); std::cout << f << '\n'; }

here's command use:

g++ -std=c++11 -o test test.cpp

i error:

test.cpp:8:9: error: 'stof' not fellow member of 'std' f = std::stof(s); ^

the file bits\basic_string.h declares std::stof included in string header, , checked bits\basic_string.h std::stof's declaration, , it's there.

after bit of googling did find old patches mingw (4.6 - 4.7) seem irrelevant since i'm on gcc 4.8.

any ideas? in advance.

not sure exact problem, check mingw-w64 have gcc 4.9.2 now. compiles code well. (but since mingw-w64 project on sourceforge.net moving mingw-w64.org it's improve utilize mingw-w64.org)

despite of it's name provides compilers both x86 , x64 targets.

probably should comment, not answer.

c++ c++11 mingw

No comments:

Post a Comment