0
當我嘗試編譯時,出現這個奇怪的錯誤。編譯器錯誤:架構x86_64的未定義符號
爲架構x86_64的未定義符號: 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;
}
任何想法?
顯然你忘了提供鏈接器與該函數的編譯版本 – 2013-02-28 20:49:07