
Jeff,
Try #include
It seems that most people are getting past this, but I have been unable to get serialization to get to work on even simple classes. A search of the last three months' archives and google didn't turn up anything obvious, so I am relying on your good humor.
When I try to compile a (I think simple) class like
#include <fstream> #include
#include #include class Card { public: Card():name("Icky"){} private: std::string name;
friend class boost::serialization::access; template <class Archive> void serialize(Archive &ar, const unsigned int version) { ar & name; } };
int main(int argc, char *argv[]) { const Card Howdy;
std::ofstream ofs("Foo"); boost::archive::text_oarchive oa(ofs);
oa << Howdy; }
I get myriad errors
mcbeth@sirocco ~/tmp/blah $ g++ blah.cpp -lboost_serialization /usr/include/boost/archive/detail/oserializer.hpp: In constructor 'boost::archive::detail::oserializer
::oserializer() [with Archive = boost::archive::text_oarchive, T = Card]': /usr/include/boost/archive/detail/oserializer.hpp:135: instantiated from 'static boost::archive::detail::oserializer & boost::archive::detail::oserializer ::instantiate() [with Archive = boost::archive::text_oarchive, T = Card]' /usr/include/boost/archive/detail/oserializer.hpp:264: instantiated from 'static void boost::archive::detail::save_non_pointer_type ::save_standard::invoke(Archive&, const T&) [with Archive = boost::archive::text_oarchive, T = Card]' /usr/include/boost/archive/detail/oserializer.hpp:322: instantiated from 'static void boost::archive::detail::save_non_pointer_type ::invoke(Archive&, const T&) [with Archive = boost::archive::text_oarchive, T = Card]' /usr/include/boost/archive/detail/oserializer.hpp:536: instantiated from 'void boost::archive::save(Archive&, const T&) [with Archive = boost::archive::text_oarchive, T = Card]' /usr/include/boost/archive/basic_text_oarchive.hpp:78: instantiated from 'void boost::archive::basic_text_oarchive<Archive>::save_override(T&, int) [with T = const Card, Archive = boost::archive::text_oarchive]' /usr/include/boost/archive/detail/interface_oarchive.hpp:78: instantiated from 'Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = const Card, Archive = boost::archive::text_oarchive]' blah.cpp:26: instantiated from here /usr/include/boost/archive/detail/oserializer.hpp:107: error: incomplete type 'boost::serialization::extended_type_info_null<Card>' used in nested name specifier /usr/include/boost/archive/detail/oserializer.hpp: In member function 'bool boost::archive::detail::oserializer ::is_polymorphic() const [with Archive = boost::archive::text_oarchive, T = Card]': blah.cpp:26: instantiated from here /usr/include/boost/archive/detail/oserializer.hpp:131: error: invalid use of undefined type 'struct boost::serialization::extended_type_info_null<Card>' /usr/include/boost/serialization/type_info_implementation.hpp:26: error: declaration of 'struct boost::serialization::extended_type_info_null<Card>' /usr/include/boost/archive/detail/oserializer.hpp:132: error: invalid use of undefined type 'struct boost::serialization::extended_type_info_null<Card>' /usr/include/boost/serialization/type_info_implementation.hpp:26: error: declaration of 'struct boost::serialization::extended_type_info_null<Card>' The relevant bit seems to be that extended_type_info_null<Card> is an incomplete type, which would point to me missing an important header or something. Relevant details Fails on (with slightly different wording but same errors) Gentoo Linux, g++-4.1.1, Boost 1.33.1 Gentoo Linux, g++-3.4.6, Boost 1.33.1 Max OSX (Tiger), g++-4.0.1, Boost 1.33.1 Max OSX (Tiger), g++-3.3, Boost 1.33.1
If needed, I can try it out on a WinXP box with VS2003 in about 7 hours.
Thanks again for your patience Jeff
--
:: Mikko Vainio