title: stoi is not declared in this scope?
body: <p>I am trying to convert a <code>string</code> into <code>int</code> using <code>stoi()</code> but i am getting error that <code>error: ‘stoi’ was not declared in this scope</code>. Here is the given code.   </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  int main()
  {
      std::string str1 = "45";
      std::string str2 = "3.14159";
      std::string str3 = "31337 with words";
      std::string str4 = "words and 2";
  
      int myint1 = std::stoi(str1);
      int myint2 = std::stoi(str2);
      int myint3 = std::stoi(str3);
      // error: 'std::invalid_argument'
      // int myint4 = std::stoi(str4);
  
      std::cout &lt;&lt; "std::stoi(\"" &lt;&lt; str1 &lt;&lt; "\") is " &lt;&lt; myint1 &lt;&lt; '\n';
      std::cout &lt;&lt; "std::stoi(\"" &lt;&lt; str2 &lt;&lt; "\") is " &lt;&lt; myint2 &lt;&lt; '\n';
      std::cout &lt;&lt; "std::stoi(\"" &lt;&lt; str3 &lt;&lt; "\") is " &lt;&lt; myint3 &lt;&lt; '\n';
      //std::cout &lt;&lt; "std::stoi(\"" &lt;&lt; str4 &lt;&lt; "\") is " &lt;&lt; myint4 &lt;&lt; '\n';
  }
  </code></pre>