我试图弄清楚为什么现在它坏了,因为我让它工作了,但我不确定出了什么问题。我正在尝试从已打开的文件中获取简单的 getline,但是,编译器不断给我错误。我试过找其他人解决这些问题,但我找不到其他人有这个问题。有什么建议吗?
void Foo::bar(ifstream &inputFile)
{
// Read in the data, parse it out, and
// call loadQueue
string input;
do {
getline(inputFile, input);
loadQueue(input);
}while (!(inputFile.eof()));
}
这是我得到的回报:
g++ -c -o Airworthy.o Airworthy.cpp
Foo.cpp: In member function ‘void Airworthy::readData(std::ifstream&)’:
Foo.cpp:25:27: error: no matching function for call to ‘getline(std::ifstream&, std::string&)’
Foo.cpp:25:27: note: candidates are:
In file included from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:55:0,
from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
关于问题是什么的任何想法?