Boost logo

Boost :

From: Clif Houck (chouck_at_[hidden])
Date: 2008-03-17 18:09:22


Robert Ramey <ramey <at> rrsd.com> writes:

>
> Hmmm - there is a test - http://www.rrsd.com/boost/library_status.html
>
> test_shared_ptr_132_text_archive
>
> which compiles and runs. How is this different than your
> situation? Doe sthe test need to be enhanced?
>
> Robert Ramey
>
> Clif Houck wrote:
> > Robert Ramey <ramey <at> rrsd.com> writes:
> >
> >>
> >> I'm not sure about the state of this. You might try the code at
> >> www.rrsd.com
> >> (1.36) and let me know how that works out.
> >>
> >> Robert Ramey
> >>
> >
> > Simply substituting 1.36 headers from your website for the 1.35 ones,
> > gives me the same errors:
> >
> > g++ what.cc -o what -I /home/chouck/Desktop/BoostZip/ -I
> > /usr/local/include/boost-1_35/ -lboost_serialization-gcc41-mt-1_35
> > /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp: In
> > function 'void boost::serialization::load(Archive&,
> > boost::shared_ptr<U>&, unsigned int)':
> > /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123:
> > error: 'null_deleter' is not a member of 'boost::archive::detail'
> > /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123:
> > error: 'null_deleter' is not a member of 'boost::archive::detail'
> > /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123:
> > error: template argument 2 is invalid
> > /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123:
> > error: expected `>' before '*' token
> > /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123:
> > error: expected `(' before '*' token
> > /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:124:
> > error: expected primary-expression before '>' token
> > make: *** [all] Error 1
> >
> > So it appears your current headers have the same problem.
> >
> > Clif
> >
> >
> >
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>

Well, I figured out what the problem was after diagnosing a little bit further.
Apparently you must include at least one archive header before the shared_ptr
header for correct compilation to occur.

This example:

//This header must come BEFORE the shared_ptr headers
#include <boost/archive/binary_oarchive.hpp>

#include <boost/serialization/shared_ptr_132.hpp>
#include <boost/serialization/shared_ptr.hpp>

int main()
{
    return 0;
}

Was distilled from a larger, but still simple test program I wrote to make sure
that I was writing code correctly to de-serialize 1.32 era shared_ptrs. In that
program I made the mistake of including the archive headers AFTER the shared_ptr
headers.

I was under the impression that the serialization library had dispensed with
header-order dependencies. I guess this isn't the case? Perhaps I didn't read
the documentation closely enough. In any case, order dependencies for headers is
very counter-intuitive and I'm sure a lot of other users have/will run into this
problem. Is there some way to break the dependency?

Clif Houck


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk