Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization: Newbie] Compilation Problem Text Archive
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-07-31 11:07:24


Are there any comments at oserializer.hpp line # 564 ?

Robert Ramey

Soumen wrote:
> Hi,
>
> I'm facing some compilation problem when I use text archive. But the
> same code works fine when I use binary archive. And it does write
> something on disk with specified file name (I'm yet to finish the
> restore part. Otherwise, I could've said it works). Do I need to do
> something differently?
>
> The error I get is something like following:
> ------------------------------------------------------------------------------------------
> /boost/1_35_0/include/boost/archive/detail/oserializer.hpp: In
> function 'void boost::archive::save(Archive&, T&) [with Archive =
> boost::archive::text_oarchive, T = TableMgr*]':
> /boost/1_35_0/include/boost/archive/detail/common_oarchive.hpp:64:
> instantiated from 'void
> boost::archive::detail::common_oarchive<Archive>::save_override(T&,
> int) [with T = TableMgr*, Archive = boost::archive::text_oarchive]'
> /boost/1_35_0/include/boost/archive/basic_text_oarchive.hpp:75:
> instantiated from 'void
> boost::archive::basic_text_oarchive<Archive>::save_override(T&, int)
> [with T = TableMgr*, Archive = boost::archive::text_oarchive]'
> /boost/1_35_0/include/boost/archive/detail/interface_oarchive.hpp:64:
> instantiated from 'Archive&
> boost::archive::detail::interface_oarchive<Archive>::operator<<(T&)
> [with T = TableMgr*, Archive = boost::archive::text_oarchive]'
> /remote/gsoumen/hiers/trunk/code/cmds/Cmds.cpp:1518: instantiated
> from here
> /boost/1_35_0/include/boost/archive/detail/oserializer.hpp:564: error:
> invalid application of 'sizeof' to incomplete type
> 'boost::STATIC_ASSERTION_FAILURE<false>'
> cc1plus: warnings being treated as errors
> ------------------------------------------------------------------------------------------
>
> My code is something like following:
>
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/archive/text_iarchive.hpp>
> //I use binary archive hpp when I use binary archive mode
>
> #include <boost/serialization/serialization.hpp>
> #include <boost/serialization/utility.hpp>
>
>
> std::ofstream ofs(fileName.c_str(), ios_base::out); // with bin
> archive I also use ios_base::binary
> boost::archive::text_oarchive oarchive(ofs); //for bin archive,
> oarchive is of binary_oarchive type
>
> TableMgr *tblMgr = TableMgr::instance();
> if (tblMgr) {
> oarchive << tblMgr;
> }
>
> //I've TableMgr::serialize() defined ...
>
> Regards,
> ~ Soumen


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