Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with Boost Serialization
From: Matthias Troyer (troyer_at_[hidden])
Date: 2010-03-02 08:49:35


On Mar 1, 2010, at 1:50 PM, Binh Luong wrote:

> Hello,
>
> i have some problems with the serialization of boost. I am working now with a program and want to use boost to serialize an object to a xml archive. I have read the tutorials on the homepage and make the necessary steps but still get some errors while compiling:
> In file included from /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/xml_oarchive.hpp:31,
> from message/remote/RemoteMessagingSystem.h:30,
> from message/remote/RemoteMessagingSystem.cpp:1:
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/basic_xml_oarchive.hpp: In member function ‘void boost::archive::basic_xml_oarchive<Archive>::save_override(T&, int) [with T = Message* const, Archive = boost::archive::xml_oarchive]’:
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/detail/interface_oarchive.hpp:64: instantiated from ‘Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = Message* const, Archive = boost::archive::xml_oarchive]’
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/detail/interface_oarchive.hpp:72: instantiated from ‘Archive& boost::archive::detail::interface_oarchive<Archive>::operator&(T&) [with T = Message*, Archive = boost::archive::xml_oarchive]’
> message/remote/RemoteMessagingSystem.cpp:147: instantiated from here
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/basic_xml_oarchive.hpp:92: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::serialization::is_wrapper<Message* const>::************)’
> In file included from /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/xml_iarchive.hpp:24,
> from message/remote/RemoteMessagingSystem.h:31,
> from message/remote/RemoteMessagingSystem.cpp:1:
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/basic_xml_iarchive.hpp: In member function ‘void boost::archive::basic_xml_iarchive<Archive>::load_override(T&, int) [with T = Message*, Archive = boost::archive::xml_iarchive]’:
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/xml_iarchive.hpp:80: instantiated from ‘void boost::archive::xml_iarchive_impl<Archive>::load_override(T&, int) [with T = Message*, Archive = boost::archive::xml_iarchive]’
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/detail/interface_iarchive.hpp:61: instantiated from ‘Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = Message*, Archive = boost::archive::xml_iarchive]’
> message/remote/RemoteMessagingSystem.cpp:164: instantiated from here
> /home/v0d0i/libraries/boost_1_42_0/include/boost/archive/basic_xml_iarchive.hpp:70: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::serialization::is_wrapper<Message*>::************)’
> make[2]: *** [RemoteMessagingSystem.o] Error 1
> make[2]: Leaving directory `/home/v0d0i/workspace/trunk1/src/base'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/v0d0i/workspace/trunk1/src'
> make: *** [all-recursive] Error 1
>
> It seems like there is something wrong with the Wrapper although i have defined the following Wrappers:
> BOOST_CLASS_IS_WRAPPER(Message*);
> BOOST_CLASS_IS_WRAPPER(Message* const);
> BOOST_CLASS_IS_WRAPPER(Message);
> I also used the boost::serialization::make_nvp for the name-value pairs purpose of xml archive.
>
> What am i doing wrong?
>
> Thanks,
> Ngoc Mai

You should not have to define your class as a wrapper. Can you send the code fragment that causes the problem?

Matthias



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