Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2464 Discussions

undefined reference to `tbb::internal::NFS_Free(void*)'

spervez
Beginner
2,917 Views
Hi everyone, I wrote a simple program to use a concurrent_priority_queue. I followed the sample code. Here's all I have right now.
#include "/tbb/concurrent_priority_queue.h"
#include
using namespace std;
using namespace tbb;
typedef std::pair vertex_rec;
class compare_f {
public:
bool operator()(const vertex_rec& u, const vertex_rec& v) const {
return u.second>v.second;
}
};
concurrent_priority_queue open_set;
Compiling this gives me an error.
/tmp/ccIzLsvO.o: In function `tbb::cache_aligned_allocator<:PAIR> >::deallocate(std::pair*, unsigned long)'\\
:
tbb.C:(.text._ZN3tbb23cache_aligned_allocatorISt4pairImdEE10deallocateEPS2_m[tbb::cache_aligned_allocator<:PAIR> >::deallocate(std\\
::pair*, unsigned long)]+0x19): undefined reference to `tbb::internal::NFS_Free(void*)'
collect2: ld returned 1 exit status
So the linker cannot find a reference to NFS_Free? Can anyone help me compile this? Many thanks.
0 Kudos
1 Solution
Vladimir_P_1234567890
2,917 Views
hello spervez,
Did you added tbb library (-ltbb) to linker command line?
--Vladimir

View solution in original post

0 Kudos
2 Replies
Vladimir_P_1234567890
2,918 Views
hello spervez,
Did you added tbb library (-ltbb) to linker command line?
--Vladimir
0 Kudos
spervez
Beginner
2,917 Views
That seems to be the source of the problem.
/usr/bin/ld: cannot find -ltbb
I did a source build of tbb. There is no libs folder and I couldnt find a file name tbb.so, or similar. Would I have to download this file from somewhere?
Update: thanks for your help. I realized I needed to run the tbbvars.sh script and everything seems ok now. Thanks again.
0 Kudos
Reply