Note
Please remove the duplicate mark for this question. Although the error was due to missing -ltbb flags, the main motive of the question was how to change the container_generator in boost graph to use your own specific container such as concurrent vector as provided by TBB. People may ignore the answered question because it is marked duplicate.
I was trying to define my custom container for my boost adjacency_list<> typedef. As per the documentation here, I tried to use tbb::concurrent_vector<>
as my custom container. Here is my code, and I get the following error:
#include <boost/graph/adjacency_list.hpp>
#include "tbb/concurrent_vector.h"
struct concVecS { };
namespace boost {
template <class ValueType>
struct container_gen<concVecS, ValueType> {
//typedef std::list<ValueType> type;
typedef tbb::concurrent_vector<ValueType> type;
};
template<>
struct parallel_edge_traits<concVecS > {
typedef allow_parallel_edge_tag type;
};
}
typedef boost::adjacency_list <concVecS, boost::vecS, boost::directedS> MyGraph;
int main(int, char*[])
{
MyGraph g(5);
return 0;
}
Error:
/tmp/cc3YbTER.o: In function
tbb::concurrent_vector<boost::detail::sep_<unsigned long, boost::no_property>, tbb::cache_aligned_allocator<boost::detail::sep_<unsigned long, boost::no_property> > >::~concurrent_vector()': /cm/shared/apps/intel-tbb-oss/intel64/42_20131003oss/include/tbb/concurrent_vector.h:888: undefined reference to
tbb::internal::concurrent_vector_base_v3::internal_clear(void ()(void, unsigned long))' /cm/shared/apps/intel-tbb-oss/intel64/42_20131003oss/include/tbb/concurrent_vector.h:890: undefined reference totbb::internal::concurrent_vector_base_v3::~concurrent_vector_base_v3()' /cm/shared/apps/intel-tbb-oss/intel64/42_20131003oss/include/tbb/concurrent_vector.h:890: undefined reference to
tbb::internal::concurrent_vector_base_v3::~concurrent_vector_base_v3()' /tmp/cc3YbTER.o: In functiontbb::cache_aligned_allocator<boost::detail::sep_<unsigned long, boost::no_property> >::deallocate(boost::detail::sep_<unsigned long, boost::no_property>*, unsigned long)': /cm/shared/apps/intel-tbb-oss/intel64/42_20131003oss/include/tbb/cache_aligned_allocator.h:96: undefined reference to
tbb::internal::NFS_Free(void*)' /tmp/cc3YbTER.o: In functiontbb::cache_aligned_allocator<boost::detail::sep_<unsigned long, boost::no_property> >::allocate(unsigned long, void const*)': /cm/shared/apps/intel-tbb-oss/intel64/42_20131003oss/include/tbb/cache_aligned_allocator.h:91: undefined reference to
tbb::internal::NFS_Allocate(unsigned long, unsigned long, void*)' collect2: error: ld returned 1 exit status
I dont know what wrong I am doing. I changed the container to std::list
and it works fine. Dont know what is it I have to add more. as per documentation, this is enough atleast to create a simple graph object.