Boost logo

Boost Users :

From: James Vanns (james.vanns_at_[hidden])
Date: 2008-06-19 13:29:07


Just isn't working in 1.35. With the examples included and following this documentation:

http://www.boost.org/doc/libs/1_35_0/libs/serialization/doc/derivation.html

I get link errors if I don't include

#include <boost/archive/basic_binary_oprimitive.ipp>

and compile errors if I do:

impl/basic_binary_oprimitive.ipp: In member function ‘virtual int boost::archive::detail::output_streambuf_access<Elem, Tr>::sync()’:
impl/basic_binary_oprimitive.ipp:137: error: expected primary-expression before ‘,’ token
impl/basic_binary_oprimitive.ipp:137: error: expected primary-expression before ‘>’ token

binary_oarchive_impl.hpp:31: instantiated from here
class boost::archive::detail::output_streambuf_access<char, std::char_traits<char> >’ has no member named ‘basic_streambuf

Am I doing something wrong? The examples don't compile so no wonder mine doesn't! Has anyone got this to work (in Boost 1.35)? I am using g++ 4.1.2 on Linux.

My code:
// Boost containers, algorithms etc.
#include <boost/detail/endian.hpp>
#include <boost/archive/binary_oarchive.hpp>

// Boost containers, algorithms etc.
using boost::archive::save_access;
using boost::archive::binary_oarchive_impl;
using boost::archive::basic_binary_oarchive;
using boost::archive::basic_binary_oprimitive;

        typedef ostream::char_type ctype;
        typedef ostream::traits_type ttype;

        template<class Archive> class binary_net_oarchive :
            public binary_oarchive_impl<Archive, ctype, ttype>
        {
            public:
                friend class save_access;
                friend class basic_binary_oarchive<Archive>;
                friend class binary_oarchive_impl<Archive, ctype, ttype>;
                friend class basic_binary_oprimitive<Archive, ctype, ttype>;

                typedef binary_oarchive_impl<Archive, ctype, ttype> base_bin_t;
            public:
                binary_net_oarchive(ostream &p_stream) : base_bin_t(p_stream, 0)
                {
                }
                template<class Type>
                void
                save(const Type &p_t)
                {
                    base_bin_t::save(p_t);
                }
        };

#include <boost/archive/impl/basic_binary_oarchive.ipp>
#include <boost/archive/impl/basic_binary_oprimitive.ipp>
#include <boost/archive/impl/archive_pointer_oserializer.ipp>

namespace boost
{
    namespace archive
    {
        using namespace fq::comms;
        template class binary_oarchive_impl<base_msg, ctype, ttype>;
        template class detail::archive_pointer_oserializer<base_msg>;
    }
}

#define BOOST_ARCHIVE_CUSTOM_OARCHIVE_TYPES base_msg

Regards,

Jim

-- 
James Vanns
Systems Programmer
Framestore CFC Ltd.

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