Skip to content

Unresolved reference when using concurrent_hash_map #1930

@IvanSavenko

Description

@IvanSavenko

Summary

Class hash_map_iterator (accessed for example via concurrent_hash_map::begin method) provides operator- which does not seems to be defined anywhere leading to linking error

Version

onetbb 2021.5.0 (as provided by Ubuntu 24.04). Same behavior was observed on 2022.3.0

Environment

  • Ubuntu 24.04
  • gcc 13.3

Observed Behavior

Linking fails with:

/usr/bin/ld: CMakeFiles/test_tbb_app.dir/main.cpp.o: in function `main':
main.cpp:(.text+0x75): undefined reference to `long tbb::detail::d2::operator-<tbb::detail::d2::concurrent_hash_map<int, int, tbb::detail::d1::tbb_hash_compare<int>, tbb::detail::d1::tbb_allocator<std::pair<int const, int> > >, std::pair<int const, int>, std::pair<int const, int> >(tbb::detail::d2::hash_map_iterator<tbb::detail::d2::concurrent_hash_map<int, int, tbb::detail::d1::tbb_hash_compare<int>, tbb::detail::d1::tbb_allocator<std::pair<int const, int> > >, std::pair<int const, int> > const&, tbb::detail::d2::hash_map_iterator<tbb::detail::d2::concurrent_hash_map<int, int, tbb::detail::d1::tbb_hash_compare<int>, tbb::detail::d1::tbb_allocator<std::pair<int const, int> > >, std::pair<int const, int> > const&)'
collect2: error: ld returned 1 exit status

Expected Behavior

Linking succeeds

Steps To Reproduce

Try to compile and link following code:

#include <tbb/concurrent_hash_map.h>

int main()
{
	tbb::concurrent_hash_map<int, int> hashMap;
	return hashMap.end() - hashMap.begin();
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions