|
Boost Users : |
Subject: Re: [Boost-users] serialization problems (undefined reference -boost::archive::detail::archive_pointer_oserializer<...>)
From: Allan Johns (nerdvegas_at_[hidden])
Date: 2008-09-16 10:27:52
Thanks Matthias, I now have an archive which works with shared_ptrs!
In my header I added:
#include <boost/archive/shared_ptr_helper.hpp>
#include <boost/serialization/shared_ptr.hpp>
, and derived my iarchive/oarchive classes from detail::shared_ptr_helper.
Then, in the cpp, I added:
#include <boost/archive/impl/archive_pointer_iserializer.ipp>
#include <boost/archive/impl/archive_pointer_oserializer.ipp>
, and
namespace boost { namespace archive {
template class detail::archive_pointer_iserializer<my_iarchive> ;
template class detail::archive_pointer_oserializer<my_oarchive> ;
}}
I guess the boost docs threw me off in this case as they have an example of an archive implementation, however no mention is made of shared_ptr serialization as a special case... I didn't think I had to do anything specific in my implementation, and indeed did not even know what an .ipp file is for...
thanks muchly
A
> From: troyer_at_[hidden]
> To: boost-users_at_[hidden]
> Date: Tue, 16 Sep 2008 13:15:59 +0200
> Subject: Re: [Boost-users] serialization problems (undefined reference -boost::archive::detail::archive_pointer_oserializer<...>)
>
> Have you looked at the source files (the *.cpp files ) of the
> archives: in the archive source files you have to
>
> #include <boost/archive/impl/archive_pointer_oserializer.ipp>
>
> or
>
> #include <boost/archive/impl/archive_pointer_iserializer.ipp>
>
> Matthias
>
>
> On Sep 16, 2008, at 11:31 AM, Allan Johns wrote:
>
> > Hi again,
> >
> > No joy so far. Have added these headers to my archive:
> >
> > #include <boost/archive/shared_ptr_helper.hpp>
> > #include <boost/archive/detail/auto_link_archive.hpp>
> >
> > and my archive now derives like so:
> > class boost_iarchive: public
> > detail::common_iarchive<boost_iarchive>, public
> > detail::shared_ptr_helper
> >
> > I still get the same undefined reference :/
> >
> >
> >
> > > To: boost-users_at_[hidden]
> > > From: ramey_at_[hidden]
> > > Date: Mon, 15 Sep 2008 08:39:09 -0800
> > > Subject: Re: [Boost-users] serialization problems (undefined
> > reference -boost::archive::detail::archive_pointer_oserializer<...>)
> > >
> > > Good point. Note that the archives included include a
> > "shared_ptr_helper"
> > > just to support shared_ptr.
> > >
> > > Robert Ramey
> > >
> > > Matthias Troyer wrote:
> > > > On Sep 15, 2008, at 11:18 AM, Allan Johns wrote:
> > > >
> > > >> Hi,
> > > >>
> > > >> I've written my own archive, which works fine until I try
> > > >> serialising a boost::shared_ptr<X>, in which case I get:
> > > >>
> > > >> undefined reference to
> > > >> `
> > > >> boost
> > > >>>> archive
> > > >>>> detail
> > > >>>> archive_pointer_oserializer
> > > >> <boost::archive::boost_oarchive>::~archive_pointer_oserializer().
> > > >> (boost::archive::boost_oarchive is my archive class, in case this
> > > >> causes confusion).
> > > >>
> > > >> I'm on gcc4.1.2, ceontos4 x86_64. I'm linking to
> > > >> libboost_serialization-gcc41-mt-1_35.so also. I've hit a bit of a
> > > >> brick wall here so any help would be greatly appreciated. I've
> > > >> searched around but can't seem to find any relevant posts on this
> > > >> subject.
> > > >>
> > > >> cheers
> > > >> A
> > > >
> > > > Do you use your own archive class? If so, please look at the
> > > > serialization source files to see how to compile the sorces for
> > your
> > > > archive and which additional headers your archive source files
> > need to
> > > > include.
> > > >
> > > > Matthias
> > >
> > >
> > >
> > > _______________________________________________
> > > Boost-users mailing list
> > > Boost-users_at_[hidden]
> > > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> > Try Facebook in Windows Live Messenger! Try it Now!
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
_________________________________________________________________
Win New York holidays with Kelloggs & Live Search
http://clk.atdmt.com/UKM/go/111354033/direct/01/
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