Deriving Serialization classes

Hi there!!! Now I'm trying to include the boost serialization library on my project through class derivation. I've followed the demo_fast_archive.cpp and the binary serialization is compiling and working fine. Now I'me trying to make the same for the text serialization and then for the xml serialization. But when compiling I'm getting these link errors: Linking... Creating library ..\..\Bin\silvestre.lib and object ..\..\Bin\silvestre.exp main2.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::archive::text_oarchive_impl<class FlowEngine::TextArchiveO>::text_oarchive_impl<class FlowEngine::TextArchiveO>(class std::basic_ostream<char,struct std::char_traits<char> > &,unsigned int)" ( ??0?$text_oarchive_impl@VTextArchiveO@FlowEngine@@@archive@boost@@QAE@AAV?$basic_ostream@DU?$char_traits@D@std@@@std@@I@Z) referenced in function "public: __thiscall FlowEngine::TextArchiveO::TextArchiveO(class std::basic_ostream<char,struct std::char_traits<char> > &,unsigned int)" ( ??0TextArchiveO@FlowEngine@@QAE@AAV?$basic_ostream@DU?$char_traits@D@std@@@std@@I@Z ) main2.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::archive::text_iarchive_impl<class FlowEngine::TextArchiveI>::text_iarchive_impl<class FlowEngine::TextArchiveI>(class std::basic_istream<char,struct std::char_traits<char> > &,unsigned int)" ( ??0?$text_iarchive_impl@VTextArchiveI@FlowEngine@@@archive@boost@@QAE@AAV?$basic_istream@DU?$char_traits@D@std@@@std@@I@Z) referenced in function "public: __thiscall FlowEngine::TextArchiveI::TextArchiveI(class std::basic_istream<char,struct std::char_traits<char> > &,unsigned int)" ( ??0TextArchiveI@FlowEngine@@QAE@AAV?$basic_istream@DU?$char_traits@D@std@@@std@@I@Z ) main2.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::archive::text_iarchive_impl<class FlowEngine::TextArchiveI>::load_override(struct boost::archive::class_name_type &,int)" ( ?load_override@?$text_iarchive_impl@VTextArchiveI@FlowEngine@@@archive@boost@@QAEXAAUclass_name_type@23@H@Z) referenced in function "protected: void __thiscall FlowEngine::TextArchiveI::load_override<struct boost::archive::class_name_type>(struct boost::archive::class_name_type &,int)" ( ??$load_override@Uclass_name_type@archive@boost@@@TextArchiveI@FlowEngine@@IAEXAAUclass_name_type@archive@boost@@H@Z ) main2.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::archive::text_oarchive_impl<class FlowEngine::TextArchiveO>::save(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ( ?save@?$text_oarchive_impl@VTextArchiveO@FlowEngine@@@archive@boost@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: static void __cdecl boost::archive::save_access::save_primitive<class FlowEngine::TextArchiveO,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(class FlowEngine::TextArchiveO &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ( ??$save_primitive@VTextArchiveO@FlowEngine@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@save_access@archive@boost@@SAXAAVTextArchiveO@FlowEngine@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z ) ..\..\Bin\silvestre.exe : fatal error LNK1120: 4 unresolved externals Error executing link.exe (tool returned code: 1120) silvestre - 5 error(s), 0 warning(s) For a better understand of the problem I'm going to attach the source files Note that I've not tested/look XMLSerialization.h, so it must have errors to I guess.. -- Miguel Silvestre

a) try deriving from text_?archive_impl rather than IArray b) If you're going to put your own archive in a separate file - make sure you find a way to explicitly instantiat it. See text_oarchive.cpp in the library. c) I wouldn't recommend using the HEAD branch for "real" code since this is altered from time to time. Robert Ramey
participants (2)
-
Miguel Silvestre
-
Robert Ramey