编译器错误我从未见过有人能帮我理解吗?

时间:2012-02-20 19:56:07

标签: c++

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'

我不认为会导致链接错误...有人可以帮助我理解这个错误是什么以及它可能发生了什么?

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

1 个答案:

答案 0 :(得分:1)

您正在尝试链接到一些不存在的代码;或者肯定不适用于x86_64。 KeyValue()在哪里定义? - 链接到那个。

您可能在Mapper和Quicksort中包含了KeyValue的头文件,但没有为编译器添加源代码来处理。