[ptr_container] linker error
::static_move_ptr<struct Test,struct boost::ptr_container_detail::clone_deleter<struct boost::ptr_container_detail::reversible_ptr_container<struct boost::ptr_container_detail::sequence_config<struct Test,class std::list<void *,class std::allocator<void *> > >,struct boost::heap_clone_allocator>::null_clone_allocator<0> > >(class boost::ptr_container_detail::static_move_ptr<struct Test,struct boost::ptr_container_detail::clone_deleter<struct boost::ptr_container_detail::reversible_ptr_container<struct boost::ptr_container_detail::sequence_config<struct Test,class std::list<void *,class std::allocator<void *> > >,struct boost::heap_clone_allocator>::null_clone_allocator<0> > > &)" (??0?$static_move_ptr@UTest@@U?$clone_deleter@U ?$null_clone_allocator@$0A@@?$reversible_ptr_container@ U?$sequence_config@UTest@@V?$list@PAXV?$allocator@PAX@std@@@std@@@
Hi, I'm having trouble using the boost::ptr_container library. I seem to get this linker error with the code below under MSVC8. error LNK2001: unresolved external symbol "public: __thiscall boost::ptr_container_detail::static_move_ptr<struct Test,struct boost::ptr_container_detail::clone_deleter<struct boost::ptr_container_detail::reversible_ptr_container<struct boost::ptr_container_detail::sequence_config<struct Test,class std::list<void *,class std::allocator<void *> > >,struct boost::heap_clone_allocator>::null_clone_allocator<0> > ptr_container_detail@boost@@Uheap_clone_allocator@3@@ ptr_container_detail@boost@@@ptr_container_detail@boost@@@ ptr_container_detail@boost@@QAE@AAV012@@Z) ----- SAMPLE CODE BEGIN ----- #include <boost/ptr_container/ptr_list.hpp> struct Test { int a; int b; }; typedef boost::ptr_list< Test > MyList; typedef MyList::auto_type TestPtr; struct MyClass { MyList theList; void push( TestPtr& t ) { theList.push_back( t.release() ); } TestPtr pop() { TestPtr t = theList.pop_front(); return t; } }; int main( int argc, char* argv[] ) { TestPtr t( new Test ); MyClass c; c.push( t ); t = c.pop(); return 0; } ----- SAMPLE CODE END ----- I'm not aware of the ptr_container library having an import library and am at a loss at why this error is occurring, although it seems to be with the MyClass::pop() method. Is it because it's returning the auto_type by value? If so what are the alternatives? Any help would be greatly appreciated. Thanks Mark.
Mark Snelling wrote:
Hi,
I'm having trouble using the boost::ptr_container library. I seem to get this linker error with the code below under MSVC8.
typedef boost::ptr_list< Test > MyList; typedef MyList::auto_type TestPtr;
struct MyClass { MyList theList;
void push( TestPtr& t ) {
void push( Test* );
theList.push_back ( t.release() ); }
TestPtr pop()
std::auto_ptr<Test> pop();
{ TestPtr t = theList.pop_front(); return t; } };
return theList.pop_front().release();
I'm not aware of the ptr_container library having an import library and am at a loss at why this error is occurring, although it seems to be with the MyClass::pop() method. Is it because it's returning the auto_type by value? If so what are the alternatives?
auto_type is not copyable, so yes, this is probably your error. Try the interface modifications I suggest above -Thorsten
participants (2)
-
Mark Snelling
-
Thorsten Ottosen