2012-02-20 69 views
0
Undefined symbols for architecture x86_64: 
    "KeyValue::KeyValue()", referenced from: 
     Mapper::map() in Mapper.o 
    "KeyValueList::KeyValueList()", referenced from: 
     QuickSort::group() in QuickSort.o 
    "KeyValueList::~KeyValueList()", referenced from: 
     QuickSort::group() in QuickSort.o 
     std::vector<KeyValueList, std::allocator<KeyValueList> >::_M_insert_aux(__gnu_cxx::__normal_iterator<KeyValueList*, std::vector<KeyValueList, std::allocator<KeyValueList> > >, KeyValueList const&) in QuickSort.o 
     void std::_Destroy<KeyValueList>(KeyValueList*) in QuickSort.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

有我的代碼中沒有其他錯誤,我已經1個警告說:編譯器錯誤我從未見過有人可以幫我理解它嗎?

Implicit conversion loses integer precision: 'unsigned long' to 'int' 

,我不認爲會導致連接錯誤...有人能幫助我瞭解這個錯誤是什麼,它是如何發生的?

如果需要,我可以提供一些代碼。

+0

請顯示「KeyValue」類的定義。有幾種常見的錯誤會導致這種綜合徵,但是我不能看到你的代碼中的哪一個是錯誤的。 – zwol 2012-02-20 20:00:23

+2

這些是_linker_錯誤,而不是編譯器錯誤。 – ildjarn 2012-02-20 20:01:13

+0

也許你忘了執行這些功能。也許你忘了將相關的.obj鏈接到你的可執行文件中。也許別的東西。爲了找出答案,刪除你的程序的某些部分,直到A)你修復它,或者B)你有一個足夠小的程序在這裏複製粘貼。請參閱http://sscce.org/。 – 2012-02-20 20:01:17

回答

1

您試圖鏈接到一些不存在的代碼;或者肯定不適用於x86_64。 KeyValue()在哪裏定義? - 鏈接到。

您可能在Mapper和Quicksort中包含了KeyValue的頭文件,但未添加編譯器處理的源代碼。

+0

是的,就是這樣......我忘了定義我的構造函數和析構函數......愚蠢的我,哈哈。我從來沒有看到一個鏈接器錯誤,所以我很困惑。 – OghmaOsiris 2012-02-20 20:02:50

+0

有關鏈接的錯誤消息通常比編譯器錯誤消息少得多,因此絕對值得花時間去研究它們。 – koan 2012-02-20 21:43:20

相關問題