I am programming in c++ for the first part of VM. I get an error "stoi" was not declared in this scope. Im not sure why. I am using namespace std, and I have included iostream, fstream, and string. here is the context:
Vcom command=commands(); //get the command type
if(command==PUSH||command==POP||command==FUNC||command==CALL) //if push, pop, function, or call command...
int first=currcom.find(" ",0); //get the first part of the argument, seperated by a blank space
int second=currcom.find(" ",first+1); //get the second part of the argument
int third=currcom.find(" ", second+1); //get the third part of the argument
string line=currcom.substr(second+1, third-second-1); //meld the argument together into a string
int lineInt=stoi(line); //convert the string to an integer
return lineInt; //return the argument
atoi() also did not work. Is there a way to convert a string to an int if the components of the string are integers? as listed in my code above, first, second, and third are all integers. maybe the string line=currcom.substr() command is the culprit?