title: I'm getting the error "stoi is not a member of std" in myprogramminglab
body: <p>edit: this question has been marked as a duplicate. I did indeed look through all the previous similar questions I could find and haven't found an answer. Basically, I am not able to control how the program compiles (though I think it's already using c++11), so I'm either looking for a reason why stoi isn't working in this context OR any alternative statements that could serve the same purpose.</p>
  
  <p>I'm pretty new to c++ and am working on this project for class. It has to be submitted through myprogramminglab.com so I can't modify the compiler. The problem I'm running into is I get the following error:</p>
  
  <pre><code>CTest.cpp: In function 'void getTime(int&amp;, int&amp;, bool&amp;, std::string)':
  CTest.cpp:38: error: 'stoi' is not a member of 'std'
  CTest.cpp:39: error: 'stoi' is not a member of 'std'
  </code></pre>
  
  <p>I understand from googling that this usually would mean that my compiler isn't configured for C++11. But like I said I have no control over that aspect of myprogramminglab. Am I missing something in my code that might be able to get stoi up and running. Or if not, is there an "old" way of doing this that I can use? I can't find a good solution in my book (though I admit I might just not know what to look for) and can't test the rest of my code until I get past this compile error.</p>
  
  <p>If it's not obvious from the code, the assignment it to take input in the format HH:MM xm and calculate how many minutes are in between the two times, and output the amount in minutes (and hours and minutes) of that difference. I also have to use a function named computeDifference with the parameters mentioned (though I added the string parameter because I wanted to get the input outside of the function).</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  int computeDifference(int hours_par, int minutes_par, bool isAM_par, int hoursF_par, int minutesF_par, bool isAMF_par);
  void getTime(int&amp; minutes, int&amp; hours, bool&amp; isAM);
  int main()
  {
      int hours, minutes, fut_hours, fut_minutes, difference;
      bool isAM, fut_isAM;
      cout &lt;&lt; "Enter start time, in the format 'HH:MM xm', where 'xm' is\n";
      cout &lt;&lt; "either 'am' or 'pm' for AM or PM:";
      getTime(hours, minutes, isAM);
      cout &lt;&lt; "Enter future time, in the format 'HH:MM xm', where 'xm' is\n";
      cout &lt;&lt; "either 'am' or 'pm' for AM or PM:";
      getTime(fut_hours, fut_minutes, fut_isAM);
      difference = computeDifference(hours, minutes, isAM, fut_hours, fut_minutes, fut_isAM);
      cout &lt;&lt; "There are " &lt;&lt; difference &lt;&lt; " minutes (" &lt;&lt; (difference - (difference%60))/60 &lt;&lt; " hours and " &lt;&lt; difference%60 &lt;&lt; " minutes) between" &lt;&lt; hours &lt;&lt; ":" &lt;&lt; minutes&lt;&lt; " and " &lt;&lt; fut_hours &lt;&lt; ":" &lt;&lt; fut_minutes;
  
      return 0;
  }
  int computeDifference(int hours_par, int minutes_par, bool isAM_par, int hoursF_par, int minutesF_par, bool isAMF_par) {
      int start_total = 0, future_total = 0;
      start_total += hours_par * 60;
      start_total += minutes_par;
      if (isAM_par)
          start_total += 720;
      future_total += hoursF_par * 60;
      future_total += minutesF_par;
      if (isAMF_par)
          future_total += 720;
  
      return future_total - start_total;
        }
  void getTime(int&amp; minutes, int&amp; hours, bool&amp; isAM, string timestamp) {
      string hoursS, minutesS;
      hoursS = timestamp.substr(0, 2);
      minutesS = timestamp.substr(3, 2);
      hours = std::stoi(hoursS);
      minutes = std::stoi(minutesS);
      isAM = ("am" == timestamp.substr(6, 2));
      cout &lt;&lt; hours &lt;&lt; " " &lt;&lt; minutes &lt;&lt; " " &lt;&lt; isAM;
      cout &lt;&lt; timestamp;
  }
  </code></pre>
  
  <p>I've tried it a few different ways, for example without the std:: part. But this seems to give me the <em>least</em> errors...</p>
  
  <p>Any help would be greatly appreciated! Thanks!</p>