Help
I have a huge code and in this part it is giving me the error: "stoi was not declared in this scope". However, i put the headers:
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <map>
Can anyone help me on this?
1 2 3 4 5 6 7 8 9 10 11 12
|
vector<artigo> readArtigos() {
vector<string> encomendasFile = readFile("../resources/Encomenda_Teste.csv");
vector<artigo> encomendas;
for (int i = 0; i < encomendasFile.size(); i++) {
vector<string> line = splitLine(encomendasFile[i], ',');
artigo newEncomenda = createArtigo(stoi(line[0]), line[1], stoi(line[2]), stoi(line[3]), stoi(line[4]), line[5]);
encomendas.push_back(newEncomenda);
}
return encomendas;
}
| |
Try std::stoi
I already try and appear another error that says: "stoi" is not a member of "std".
Thanks
Same underlying problem and solution as in your other thread: -std=c++11
Do not guess what headers you do need. Use the documentation:
http://www.cplusplus.com/reference/string/stoi/
The
std::stoi
is in
<string>
...
if C++11 support is enabled.
thanks
Topic archived. No new replies allowed.