0

On MinGW 5.4.1 + GCC 4.7.2, some functionality defined in <string> missing. For example, the following fails to compile with -std=c++11:

#include <string>
#include <iostream>

int main(int,char**){
    //[Error] 'to_string' is not a member of 'std'
    std::cout << std::to_string(10);

    std::string s = "12";
    //[Error] 'stoi' is not a member of 'std'
    std::cout << std::stoi(s);
}

Why is this happening? These features are defined in c++11, so why are they not supported? Can I get them back, or do I have to write my own?

Thanks!

Fuzzyzilla
  • 356
  • 4
  • 15
  • 1
    https://stackoverflow.com/questions/12975341/to-string-is-not-a-member-of-std-says-g-mingw?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – drescherjm May 21 '18 at 20:55
  • @drescherjim Thank you. I wish MinGW wasn't so broken -_- – Fuzzyzilla May 21 '18 at 20:57
  • 1
    Can't you upgrade mingw to a newer version? – drescherjm May 21 '18 at 21:00
  • @drescherjm Honestly, my IDE and compiler setup is so janky and unstable already, I'm sure I'd break something if I tried! – Fuzzyzilla May 21 '18 at 21:06
  • @Fuzzyzilla because MinGW is so broken, a fork [mingw-w64](https://mingw-w64.org/) has occurred, which is less broken – M.M May 21 '18 at 21:31
  • @M.M I should look into it. I've already taken note of some things MinGW is missing, namely support for `std::thread` – Fuzzyzilla May 22 '18 at 00:53

0 Answers0