提问者:小点点

编译器错误:体系结构x86_64的符号未定义


当我尝试编译时,我得到了一个奇怪的错误。

体系结构x86_64的未定义符号:,引用自:CCLDKIBB中的_MAIN.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;
}

有什么想法吗?


共1个答案

匿名用户

我想通了。我的功能原型搞砸了。