我从未见过的编译器错误有人可以帮助我理解它吗?

compiler error I've never seen could someone help me understand it?

本文关键字:帮助 错误 编译器      更新时间:2023-10-16
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'

我认为这不会导致链接错误...有人可以帮助我了解此错误是什么以及它是如何发生的吗?

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

你试图链接到一些不存在的代码;或者肯定不是为了x86_64。KeyValue()在哪里定义?- 链接到那个。

您可能在映射器和快速排序中包含 KeyValue 的头文件,但没有添加编译器要处理的源代码。