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
#include
#include
#include
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
#include #include //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_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
::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 boost::archive::detail::pointer_oserializer ::instance' /usr/include/boost/archive/detail/oserializer.hpp:190: instantiated from 'static const boost::archive::detail::pointer_oserializer & boost::archive::detail::pointer_oserializer ::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 ::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 ::instantiate() [with Archive = boost::archive::text_oarchive, T = derived]' ... ... ... [Lots more errors]