好吧,我是新來的C++,所以我想了解什麼信息可以從錯誤消息中獲得。瞭解「未定義的架構符號」錯誤
以下是錯誤消息
Undefined symbols for architecture x86_64: "PieceClothing::PieceClothing(int)", referenced from: ClothesInventory::getPieceOfClothing(long) in ClothesInventory.o ClothesInventory::insertIntocloset(std::basic_string, std::allocator >)in ClothesInventory.o "PieceClothing::PieceClothing()", referenced from: ClothesInventory::ClothesInventory()in ClothesInventory.o ClothesInventory::ClothesInventory(std::basic_string, std::allocator >)in ClothesInventory.o std::map, std::allocator > >::operator[](long const&)in ClothesInventory.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status
這裏是我的理解:
- 有兩種錯誤;
- 一個與getPieceOfClothing和insertIntocloset有關的事情;
- 其他在構造函數中可能是關於我在那裏的地圖和/或迭代器。
只是爲了澄清,我沒有附上代碼,因爲問題的關鍵是要了解我能從信息中得到的所有信息。
感謝您的任何幫助。
'for architecture' - 您是否正在使用可能一次鏈接多個體繫結構的工具鏈,例如: Mac連接x64和PPC?我認爲這是一個紅鯡魚 - 它只是告訴你,它無法找到PieceClothing構造函數的實現 - 你是否明確實現了這些?你是否確實將它們連接起來? – Rup 2012-04-27 11:00:23