Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-08-13 15:17:55


Hmm - I just compiled it on a couple of cmpilers here. gcc 34,
MSVC 7.1, borland 5.64.

I'm using boost 1.34 + improvements in the serializaiton lirbrar
so it might not be the same as you.

What version of boost are you using?
What version of gcc?

If its 1.33 or below try using the following header setup:

> #include <boost/archive/text_oarchive.hpp>
> #include <boost/archive/text_iarchive.hpp>

> #include <boost/serialization/base_object.hpp>
#include <boost/include/export.hpp>

Robert Ramey

Jeshua Bratman wrote:
> Robert Ramey wrote:
>>
>> I compiled this code with the change below. Uncomment
>> one of the serialization functions.
>>
>
> Hmm. I still couldn't compile it with those changes. Here's the cpp
> file I tried to compile:
>
> error.cpp:
> #include <boost/serialization/base_object.hpp>
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/archive/text_iarchive.hpp>
>
>
> //BASE
> class base
> {
> public:
> virtual void virt_func() = 0;
> };
> BOOST_IS_ABSTRACT(base);
>
> //DERIVED
> class derived : public base
> {
> public:
> void virt_func() {}
> template<class Archive>
> void serialize(Archive& ar, const unsigned int version);
> };
> #include <boost/serialization/export.hpp>
> BOOST_CLASS_EXPORT_GUID(derived,"derived")
>
>
> //MAIN
> int main()
> {
> return 0;
> }
>
>
> And when I try to compile it:
>
>
> $ g++ error.cpp -lboost_serialization
>
> /usr/include/boost/serialization/export.hpp: In static member function
> 'static void
> boost::archive::detail::guid_initializer<T>::export_register(const
> char*) [with T = derived]':
> /usr/include/boost/serialization/export.hpp:155: instantiated from
> 'boost::archive::detail::guid_initializer<T>::guid_initializer(const
> char*) [with T = derived]'
> error.cpp:23: instantiated from here
> /usr/include/boost/serialization/export.hpp:146: error: incomplete
> type 'boost::serialization::extended_type_info_null<derived>' used in
> nested name specifier
> /usr/include/boost/archive/detail/oserializer.hpp: In constructor
> 'boost::archive::detail::pointer_oserializer<T,
> Archive>::pointer_oserializer() [with T = derived, Archive =
> boost::archive::text_oarchive]':
> /usr/include/boost/archive/detail/oserializer.hpp:198: instantiated
> from 'const boost::archive::detail::pointer_oserializer<derived,
> boost::archive::text_oarchive>
> boost::archive::detail::pointer_oserializer<derived,
> boost::archive::text_oarchive>::instance'
> /usr/include/boost/archive/detail/oserializer.hpp:190: instantiated
> from 'static const boost::archive::detail::pointer_oserializer<T,
> Archive>& boost::archive::detail::pointer_oserializer<T,
> Archive>::instantiate() [with T = derived, Archive =
> boost::archive::text_oarchive]'
> /usr/include/boost/archive/detail/oserializer.hpp:515: instantiated
> from 'const boost::archive::detail::basic_pointer_oserializer&
> boost::archive::detail::instantiate_pointer_oserializer(Archive*, T*)
> [with Archive = boost::archive::text_oarchive, T = derived]'
> /usr/include/boost/serialization/export.hpp:83: instantiated from
> 'static void boost::archive::detail::export_impl::archive<Archive,
> T>::o::invoke() [with Archive = boost::archive::text_oarchive, T =
> derived]' /usr/include/boost/serialization/export.hpp:105:
> instantiated from 'static void
> boost::archive::detail::export_impl::archive<Archive,
> T>::instantiate() [with Archive = boost::archive::text_oarchive, T =
> derived]' ... ... ...
> [Lots more errors]


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