当我尝试编译时,我遇到了这个奇怪的错误。
架构x86_64的未定义符号:
readRecipe(std::basic_istream<char, std::char_traits<char> >&, std::basic_ostream<char, std::char_traits<char> >&, Cookbook&)
,引自:
_main in cclDKibb.o
ld:找不到架构x86_64的符号
collect2:ld返回1退出状态
这是它所指的功能:
void readRecipe(std::ifstream &istr, std::ofstream &ostr, Cookbook &cookbook)
{
int units; std::string name, name2;
// Read recipe name.
istr >> name;
// Build the new recipe Recipe r(name);
while (1)
{
istr >> units;
if (units == 0)
break;
assert (units > 0);
istr >> name2;
Ingredient i(name2, units);
r.addIngredient(i);
}
// Add it to the list.
if (cookbook.addRecipe(r, ostr))
ostr << "Recipe for " << name << " added" << std::endl;
else
ostr << "Recipe for " << name << "already exists" << std::endl;
}
有什么想法吗?
答案 0 :(得分:0)
我明白了。我的功能原型搞砸了。