Boost logo

Boost Users :

From: Mark Snelling (mark.snelling_at_[hidden])
Date: 2006-11-17 09:25:51


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> >
>::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_at_UTest@@U?$clone_deleter_at_U
?$null_clone_allocator@$0A@@?$reversible_ptr_container@
U?$sequence_config_at_UTest@@V?$list_at_PAXV?$allocator_at_PAX@std@@@std@@@
ptr_container_detail_at_boost@@Uheap_clone_allocator_at_3@@
ptr_container_detail_at_boost@@@ptr_container_detail_at_boost@@@
ptr_container_detail_at_boost@@QAE_at_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.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net