std::stoi missing in g++ 4.7.2?

前端 未结 2 1379
遇见更好的自我
遇见更好的自我 2020-12-16 01:17

I get the error message \"stoi is not a member of std\" when I try to use std::stoi and try to compile it. I\'m using g++ 4.7.2 from the command line so it can\'t be IDE err

2条回答
  •  太阳男子
    2020-12-16 01:36

    std::stoi() is new in C++11 so you have to make sure you compile it with:

    g++ -std=c++11 example.cpp
    

    or

    g++ -std=c++0x example.cpp
    

提交回复
热议问题