Search code examples
qnx

'getline' was not declared in this scope, what does it mean?


When compile, I have 'getline' was not declared in this scope

compiling next code:

string PostCmd::getFailedFromFile()
{
    string failedList;
    ifstream file(FILE, ifstream::in);
    if (file.is_open())
    {
        getline(file, failedList);
        file.close();
    }
    else
    {
        cout << "Unable to open file";
    }
    return failedList;
}

Solution

  • Try to include <istream>.

    More info can be seen here: http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.dinkum_en_ecpp%2Fistream.html