I am trying to take a string and parse it into an int. I have read the many answers out there, and it seems that using stoi
is the most up-to-date way. It appears to me that stoi
uses std
, but I am getting Function 'stoi' could not be resolved
despitre using namespace std;
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include<stdlib.h>
using namespace std;
int main(int argc, char* argv[]) {
string line = "";
string five = "5";
int number = stoi(five); //Error here with stoi
return 0;
}
Any ideas what is causing this?
Update:
I am using Eclipse. My flags are: -c -fmessage-length=0 -std=c++11