So, this error has been examined several times, but the answers did not help me. I use Notepad ++ and Cygwin in windows 10. My code is as follows: Derek Banas 1-hour C ++ tutorial :
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <cstdlib>
#include <sstream>
using namespace std;
int main(){
string numberGuessed;
int intNumberGuessed = 0;
do {
cout << "Guess between 1 and 10: ";
getline (cin,numberGuessed);
intNumberGuessed = stoi(numberGuessed);
cout << intNumberGuessed << endl;
} while (intNumberGuessed != 4);
cout << "You Win" << endl;
return 0;
}
and this is the error I get:
$ g++ -std=c++11 -static ctut.cpp
ctut.cpp: In function ‘int main()’:
ctut.cpp:15:43: error: ‘stoi’ was not declared in this scope
intNumberGuessed = stoi(numberGuessed);
You see that I have already applied all the suggestions in the previous answers. Is there something I'm missing? Should I start using Ming? Since Notepadd ++ is the one I found with most upvotes in a different topic here. This is what I found and tried but didn't work:
The stoi function is not declared
source
share