【发布时间】:2010-06-17 14:35:33
【问题描述】:
谁能解释我的错误,我有这个课:
class Account
{
private:
string strLastName;
string strFirstName;
int nID;
int nLines;
double lastBill;
public:
Account(string firstName, string lastName, int id);
friend string printAccount(string firstName, string lastName, int id, int lines, double lastBill);
}
但是当我调用它时:
string reportAccounts() const
{
string report(printAccountsHeader());
for(list<Account>::const_iterator i = listOfAccounts.begin(); i != listOfAccounts.end(); ++i)
{
report += printAccount(i->strFirstName, i->strLastName, i->nID, i->nLines, i->lastBill);;
}
return report;
}
我收到错误within context,有人可以解释原因吗?
【问题讨论】:
-
错误信息只是“在上下文中?”这是运行时错误还是编译时错误?没有其他消息?
-
请注意我给你的建议last time 并查看错误消息的其余部分。 “在上下文中”只是出现在编译器输出中的一行,用于 join 错误的其他两个部分。上面是实际错误,下面是编译器当时试图编译的函数的名称。摘下眼罩,放眼大局。
-
-1 表示未发布整个错误。
-
除了建议您在将来提供完整的错误消息之外,我还建议您对您喜欢的答案进行投票。在我写这篇文章时,接受的答案没有赞成票。投票需要 15 次代表,当我写这篇文章时,你显示的是 30:点击至少你接受的答案的向上箭头。