Closed eloiseh closed 6 years ago
When we try to use LockFreeArray in transaction_manager.h, the linker throws undefined reference error. Any idea why would this happen?
../lib/libpeloton.so.0.0.5: error: undefined reference to 'peloton::LockFreeArray<unsigned long>::GetSize() const' ../lib/libpeloton.so.0.0.5: error: undefined reference to 'peloton::LockFreeArray<unsigned long>::Find(unsigned long const&) const' ../lib/libpeloton.so.0.0.5: error: undefined reference to 'peloton::LockFreeArray<unsigned long>::Contains(unsigned long const&)' ../lib/libpeloton.so.0.0.5: error: undefined reference to 'peloton::LockFreeArray<unsigned long>::Append(unsigned long)' ../lib/libpeloton.so.0.0.5: error: undefined reference to 'peloton::LockFreeArray<unsigned long>::Erase(unsigned long const&, unsigned long const&)' ../lib/libpeloton.so.0.0.5: error: undefined reference to 'peloton::LockFreeArray<unsigned long>::~LockFreeArray()' ../lib/libpeloton.so.0.0.5: error: undefined reference to 'peloton::LockFreeArray<unsigned long>::LockFreeArray()' collect2: error: ld returned 1 exit status src/CMakeFiles/peloton-bin.dir/build.make:153: recipe for target 'bin/peloton' failed make[2]: *** [bin/peloton] Error 1 CMakeFiles/Makefile2:1241: recipe for target 'src/CMakeFiles/peloton-bin.dir/all' failed make[1]: *** [src/CMakeFiles/peloton-bin.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2
You probably forget the explicit template instantiation. Can you try to add
template class LockFreeArray<unsigned long>;
at the end of lock_free_array.cpp and rerun cmake?
When we try to use LockFreeArray in transaction_manager.h, the linker throws undefined reference error. Any idea why would this happen?