C++ 编译器错误:架构x86_64的未定义符号

C++ 编译器错误:架构x86_64的未定义符号,c++,compiler-errors,C++,Compiler Errors,当我试图编译时,我遇到了一个奇怪的错误 架构x86_64的未定义符号: readRecipe(std::basic\u istream&,std::basic\u ostream&,Cookbook&),参考自: _cclDKibb.o的主管道 ld:找不到架构x86_64的符号 collect2:ld返回了1个退出状态 这就是它所指的功能: void readRecipe(std::ifstream &istr, std::ofstream &ostr, Cookbook &a

当我试图编译时,我遇到了一个奇怪的错误

架构x86_64的未定义符号:
readRecipe(std::basic\u istream&,std::basic\u ostream&,Cookbook&)
,参考自: _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;
}
void readRecipe(标准::ifstream&istr,标准::ofstream&ostr,食谱和食谱)
{
int单位;标准::字符串名称,name2;
//阅读配方名称。
istr>>名称;
//构建新配方r(名称);
而(1)
{ 
istr>>单位;
如果(单位=0)
打破
断言(单位>0);
istr>>名称2;
成分i(名称2,单位);
r、 附加成分(i);
}
//将其添加到列表中。
if(食谱添加配方(r,ostr))

ostr我明白了。我的函数原型搞砸了。

显然你忘了向链接器提供该函数的编译版本