|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2007-02-08 11:11:57
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 <boost/serialization/string.hpp>
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/archive/text_iarchive.hpp>
>
> 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_at_sirocco ~/tmp/blah $ g++ blah.cpp -lboost_serialization
> /usr/include/boost/archive/detail/oserializer.hpp: In constructor
> 'boost::archive::detail::oserializer<Archive, T>::oserializer() [with
> Archive = boost::archive::text_oarchive, T = Card]':
> /usr/include/boost/archive/detail/oserializer.hpp:135: instantiated
> from 'static boost::archive::detail::oserializer<Archive, T>&
> boost::archive::detail::oserializer<Archive, T>::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<Archive,
>>>> 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<Archive,
>>>> 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<Archive,
> T>::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
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