
Hi all, I have some trouble with the Boost.Serialization library. I have compiled the 'demo.cpp' example, and now I am trying to distill it a little, so that I can understand how to apply it to my own polymorphic class hierarchy. However I keep seeing the same error message, and can't work out what it means. In /usr/include/boost/archive/detail/oserializer.hpp:567 there are some comments about the error message I'm seeing but I don't understand what those comments mean. I'm using Boost 1.33.1-7ubuntu1 on Ubuntu 6.10. Any help would be much appreciated! Cheers JP Here is the error message: --------------8<--------------- jpye@john:~/boosttest$ scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... g++ -o ser1.o -c ser1.cpp /usr/include/boost/archive/detail/oserializer.hpp: In function 'void boost::archive::save(Archive&, T&) [with Archive = boost::archive::text_oarchive, T = dd]': /usr/include/boost/archive/basic_text_oarchive.hpp:78: instantiated from 'void boost::archive::basic_text_oarchive<Archive>::save_override(T&, int) [with T = dd, 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 = dd, Archive = boost::archive::text_oarchive]' ser1.cpp:43: instantiated from here /usr/include/boost/archive/detail/oserializer.hpp:567: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>' scons: *** [ser1.o] Error 1 scons: building terminated because of errors. jpye@john:~/boosttest$ -------------------------------------- Here is the code that was being compiled: -----------------8<--------------- jpye@john:~/boosttest$ cat ser1.cpp #include <iomanip> #include <iostream> #include <fstream> #include <string> #include <boost/archive/tmpdir.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/base_object.hpp> #include <boost/serialization/utility.hpp> #include <boost/serialization/list.hpp> class dd{ friend std::ostream&operator<<(std::ostream&,const dd&); friend class boost::serialization::access; double x,y; template<class Archive> void serialize(Archive & ar, const unsigned int /* file_version */){ ar & y & x; } public: // every serializable class needs a constructor dd(){}; dd(double x, double y) : x(x), y(y) {} }; std::ostream & operator<<(std::ostream &os, const dd &d) { return os << d.x << ' ' << d.y; } int main(int argc, char *argv[]){ dd D(10,20); int x = 5; std::cerr << D << std::endl; std::ofstream ofs("test.txt"); boost::archive::text_oarchive oa(ofs); oa << x; oa << D; return 0; } -------------------------------------- And, just for completeness, my build file: --------------8<---------------- jpye@ascendserver:~/boosttest$ cat SConstruct Program("test",["ser1.cpp"], LIBS=['boost_serialization']) ------------------------------------