c++ - 编译器错误 : Undefined symbols for architecture x

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

架构 x86_64 的 undefined symbol :
readRecipe(std::basic_istream<char, std::char_traits<char> >&, std::basic_ostream<char, std::char_traits<char> >&, Cookbook&) ,引用自:
cclDKibb.o 中的 _main
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;
}

有任何想法吗?

最佳答案

我想到了。我的函数原型(prototype)搞砸了。

关于c++ - 编译器错误 : Undefined symbols for architecture x86_64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15145346/

相关文章:

java - Java : Longest Ascending substring

c++ - OpenCV无法编译

compilation - 安装MPFR(3.1.0)时出错

Excel VBA 错误 - 函数或接口(interface)标记为受限。或函数使用 Visual

iphone - NSInvalidArgumentException与UITableView吗?

qt - 无法运行编译qt应用程序。 Qt Creator忽略斜线

java - 升序子字符串编译错误

c++ - C++如何向minGW添加库

ios - iOS静态库取决于其他静态库

android - NDK错误: “can' t resolve `.data.rel.ro.loc