|
Boost Users : |
From: Gerald Fordyce (gfordyce_at_[hidden])
Date: 2007-11-07 10:11:59
Hi,
I am attempting to use boost::serialization to serialize a simple
derived class to an XML archive. I have no problem creating a text
archive - code compiles and the text archive contains both base class
and derived class members. If I switch to the
boost::archive::xml_oarchive it no longer compiles. Here is the code
creating the archive:
const DerivedClass obj;
std::string filename = "fooBar.xml";
std::ofstream ofs(filename.c_str());
assert(ofs.good());
{
boost::archive::xml_oarchive oa(ofs);
oa << obj;
}
Here is the gcc-4.1.2 compiler output (Ubuntu):
/usr/local/include/boost-1_34/boost/archive/basic_xml_oarchive.hpp: In
member function âvoid
boost::archive::basic_xml_oarchive<Archive>::save_override(T&, int)
[with T = const DerivedClass, Archive = boost::archive::xml_oarchive]â:
/usr/local/include/boost-1_34/boost/archive/detail/interface_oarchive.hpp:79: instantiated from âArchive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = const DerivedClass, Archive = boost::archive::xml_oarchive]â
mkevents.cpp:81: instantiated from here
/usr/local/include/boost-1_34/boost/archive/basic_xml_oarchive.hpp:83:
error: invalid application of âsizeofâ to incomplete type
âboost::STATIC_ASSERTION_FAILURE<false>â
So I'm wondering if the requirements for using txt_oarchive are
different than for xml_oarchive? It seems they should both work the
same.
Thanks
Gerald
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