
I took your code and fixed it up to that below and it compile and tests fine. Note the usage of BOOST_SERIALIZATION_BASE_OBJECT_NVP below which is key. This is explained in the documentation. Robert Ramey Luca Cappa wrote: #include <boost/serialization/shared_ptr.hpp> #include <boost/archive/xml_oarchive.hpp> #include <fstream> using namespace std; using namespace boost; using namespace boost::serialization; struct SerializableBase { virtual ~SerializableBase () { } template<typename Archive> void serialize (Archive& pAR, unsigned int version) { int i (0); pAR & make_nvp ("doesnotwork", i); } }; struct Serializable : public SerializableBase { int a; Serializable () : a (1) { } virtual ~Serializable () { } template<typename Archive> void serialize (Archive& pAR, unsigned int version) { pAR & BOOST_SERIALIZATION_BASE_OBJECT_NVP(SerializableBase); pAR & BOOST_SERIALIZATION_NVP (a); } };//struct void save (const Serializable& pS, const char* pFileName) { // make an archive std::ofstream ofs (pFileName); boost::archive::xml_oarchive oa (ofs); // Registering a lot of things here! oa.register_type (static_cast<Serializable*> (NULL)); SerializableBase* lS (new Serializable); oa << make_nvp ("lS", lS); } int main () { Serializable s; save (s, "serializable.xml"); }