Dec 11, 2018 at 10:26am UTC
The problem is that you use the same name for both variable and class. When the compiler sees "cais" on line 7 it sees a variable but a variable does not make sense there.
Dec 11, 2018 at 10:45am UTC
But I have another vector, with the exact same structure that didn't give me any kind of error:
vector<encomenda> readEncomendas() {
vector<string> encomendasFile = readFile("Encomendas.txt");
vector<encomenda> encomendas;
for (int i=1; i < encomendasFile.size(); i++){
vector<int> line = splitLine(encomendasFile[i], ';');
encomenda newEncomenda = createEncomenda(line[0], line[1], line[2], line[3]);
encomendas.push_back(newEncomenda);
}
return encomendas;
}
vector<local> readLocais() {
vector<string> locaisFile = readFile("Locais.txt");
vector<local> locais;
for (int i=1; i < locaisFile.size(); i++){
vector<int> line = splitLine(locaisFile[i], ';');
local newLocal = createlocal(line[0], line[1], line[2], line[3]);
locais.push_back(newLocal);
}
return locais;
Dec 11, 2018 at 11:03am UTC
Thank you very much!!! It works now!