
I see nothing wrong with your example. I compiled your code with no problems or messages of any kind on the following compilers: VC 7.1, Borland 5.51 Borland 5.64, Commeau, gcc 3.3 I am using the Boost Head branch. But that shouldn't make a difference. can you compile any of the tests or demos included with the package? Robert Ramey Jeffrey Brent McBeth wrote:
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
::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