|
Boost Users : |
Subject: Re: [Boost-users] Serialization of forward declared class
From: niranjan bangera (niranjannina_at_[hidden])
Date: 2009-01-12 00:19:14
hi all,
> i have done in the following way.. even am getting some errors, did i miss
> any of the headers, or added extra(added extra for sure).
>
> Any suggestions will be accepted
>
> #include <boost/serialization/utility.hpp>
> #include <boost/serialization/collection_traits.hpp>
> #include <boost/serialization/serialization.hpp>
> #include <boost/serialization/base_object.hpp>
> #include <fstream>
> #include <boost/archive/text_iarchive.hpp>
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/serialization/assume_abstract.hpp>
>
> class fd;
>
> class base: class derived
> {
> .....
> fd *ptr;
> .....
>
> friend class boost::serialization::access;
> template<class Archive>
> void serialize(Archive & ar, const unsigned int file_version)
> {
> (void) file_version;
> ar & ptr;
> ar & boost::serialization::base_object<derived>(*this);
>
> }
>
> }; //end of class base
>
> Version::1.36.0
> compliler: g++ 4.1.1....
>
> i am getting a error :
> error: forward declaration of 'struct fd'
> /boost_1_36_0/include/boost-1_36/boost/serialization/access.hpp:109: error:
> inva
> lid use of undefined type 'struct
>
> /project/wipro_virtutech_nobackup/users/niranjan/project_new/boost_1_36_0/include/boost-1_36/boost/serialization/extended_type_info_typeid.hpp:117:
> note: neither the destructor nor the class-specific operator delete will be
> called, even if they are declared when the class is defined.
>
> Thanks in advance.....
>
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