|
Boost Users : |
Subject: Re: [Boost-users] [Serialization: Newbie] Compilation Problem Text Archive
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-07-31 14:29:54
Try
const TableMgr *tblMgr = TableMgr::instance();
if (tblMgr) {
oarchive << tblMgr;
}
Robert Ramey
Soumen wrote:
> Hi,
>
> This is what is there:
>
> // if your program traps here, it indicates that your doing one of
> the following:
> // a) serializing an object of a type marked "track_never" through
> a pointer.
> // b) saving an non-const object of a type not markd "track_never)
> // Either of these conditions may be an indicator of an error
> usage of the
> // serialization library and should be double checked. See
> documentation on
> // object tracking. Also, see the "rationale" section of the
> documenation
> // for motivation for this checking.
>
> I'm _not_ explicitly using track_never through BOOST_CLASS_TRACKING
> macro.
>
> If I'm using something incorrectly, how does it (same code) work with
> binary_oarchive?
>
> Regards,
> ~ Soumen
>
>
> Robert Ramey wrote:
>>
>> 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 mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
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