2012-02-20 74 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

相关问题