
You'll need to explicitly instantiate the templated code. Look in the library for test_oarchive.cpp on how to do this. I'm not sure why he MS compiler produces warnings on your code. None of the other compilers I test with do. Including the following in rsg_text_oarchive class- which should not be necessary - diminished the number of warnings to 3 // explicitly forward save for other types to the base class. template<class T> void save(const T & t){ boost::archive::text_oarchive_impl<Archive>::save(t); } Robert Ramey Robert S. Grimes wrote:
So its safe to say its a compiler problem. In your case you might just make all the member public.
Thanks, Robert, but now I get a bunch of warnings, plus link errors. The same is true for my text input archive. Both are attached. I'm hoping it's pretty simple, and that soon I'll understand it too! Here are examples of the warning messages, and the link errors:
1>c:\boost\include\boost-1_33_1\boost\archive\text_oarchive.hpp(75) : warning C4661: 'void boost::archive::text_oarchive_impl<Archive>::save(const std::wstring &)' : no suitable definition provided for explicit template instantiation request 1> with 1> [ 1> Archive=rsg_text_oarchive 1> ] 1> c:\boost\include\boost-1_33_1\boost\archive\text_oarchive.hpp(66)
see declaration of 'boost::archive::text_oarchive_impl<Archive>::save' 1> with 1> [ 1> Archive=rsg_text_oarchive 1> ]
-- more warnings for output archive --
1>c:\boost\include\boost-1_33_1\boost\archive\text_iarchive.hpp(44) : warning C4661: 'boost::archive::text_iarchive_impl<Archive>::text_iarchive_impl(std::istrea m &,unsigned int)' : no suitable definition provided for explicit template instantiation request 1> with 1> [ 1> Archive=rsg_text_iarchive 1> ] 1> c:\boost\include\boost-1_33_1\boost\archive\text_iarchive.hpp(71)
see declaration of 'boost::archive::text_iarchive_impl<Archive>::text_iarchive_impl' 1> with 1> [ 1> Archive=rsg_text_iarchive 1> ]
-- more warnings for input archive --
1>Linking... 1> Creating library C:\Clients\RSG\Projects\version_2\experiments\FileManagerTests\Debug\BinArch iveTest.lib and object C:\Clients\RSG\Projects\version_2\experiments\FileManagerTests\Debug\BinArch iveTest.exp 1>RSGTextTests.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::archive::text_iarchive_impl<class rsg_text_iarchive>::text_iarchive_impl<class rsg_text_iarchive>(class std::basic_istream
&,unsigned int)" (??0?$text_iarchive_impl@Vrsg_text_iarchive@@@archive@boost@@QAE@AAV?$basic_ istream@DU?$char_traits@D@std@@@std@@I@Z) referenced in function "public: __thiscall rsg_text_iarchive::rsg_text_iarchive(class std::basic_istream &,unsigned int)" (??0rsg_text_iarchive@@QAE@AAV?$basic_istream@DU?$char_traits@D@std@@@std@@I @Z) 1>RSGTextTests.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::archive::text_oarchive_impl<class rsg_text_oarchive>::text_oarchive_impl<class rsg_text_oarchive>(class std::basic_ostream &,unsigned int)" (??0?$text_oarchive_impl@Vrsg_text_oarchive@@@archive@boost@@QAE@AAV?$basic_ ostream@DU?$char_traits@D@std@@@std@@I@Z) referenced in function "public: __thiscall rsg_text_oarchive_impl<class rsg_text_oarchive>::rsg_text_oarchive_impl<class rsg_text_oarchive>(class std::basic_ostream &,unsigned int)" (??0?$rsg_text_oarchive_impl@Vrsg_text_oarchive@@@@QAE@AAV?$basic_ostream@DU ?$char_traits@D@std@@@std@@I@Z) 1>RSGTextTests.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::archive::text_iarchive_impl<class rsg_text_iarchive>::load_override(struct boost::archive::class_name_type &,int)" (?load_override@?$text_iarchive_impl@Vrsg_text_iarchive@@@archive@boost@@QAE XAAUclass_name_type@23@H@Z) referenced in function "public: class rsg_text_iarchive & __thiscall boost::archive::detail::interface_iarchive<class rsg_text_iarchive>::operator>><struct boost::archive::class_name_type>(struct boost::archive::class_name_type &)" (??$?5Uclass_name_type@archive@boost@@@?$interface_iarchive@Vrsg_text_iarchi ve@@@detail@archive@boost@@QAEAAVrsg_text_iarchive@@AAUclass_name_type@23@@Z ) 1>RSGTextTests.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::archive::text_iarchive_impl<class rsg_text_iarchive>::load(class std::basic_string &)" (?load@?$text_iarchive_impl@Vrsg_text_iarchive@@@archive@boost@@QAEXAAV?$bas ic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: static void __cdecl boost::archive::load_access::load_primitive >(class rsg_text_iarchive &,class std::basic_string &)" (??$load_primitive@Vrsg_text_iarchive@@V?$basic_string@DU?$char_traits@D@std @@V?$allocator@D@2@@std@@@load_access@archive@boost@@SAXAAVrsg_text_iarchive @@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>RSGTextTests.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::archive::text_oarchive_impl<class rsg_text_oarchive>::save(class std::basic_string const &)" (?save@?$text_oarchive_impl@Vrsg_text_oarchive@@@archive@boost@@QAEXABV?$bas ic_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 rsg_text_oarchive &,class std::basic_string const &)" (??$save_primitive@Vrsg_text_oarchive@@V?$basic_string@DU?$char_traits@D@std @@V?$allocator@D@2@@std@@@save_access@archive@boost@@SAXAAVrsg_text_oarchive @@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>C:\Clients\RSG\Projects\version_2\experiments\FileManagerTests\Debug\BinAr chiveTest.exe : fatal error LNK1120: 5 unresolved externals 1>Build log was saved at "file://c:\Clients\RSG\Projects\version_2\experiments\FileManagerTests\BinAr chiveTest\Debug\BuildLog.htm" 1>BinArchiveTest - 6 error(s), 128 warning(s) Thanks again! -Bob
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users