Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-03-16 10:57:52


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<char,struct std::char_traits<char> > &,unsigned
>> int)"
>> (??0?$text_iarchive_impl_at_Vrsg_text_iarchive@@@archive_at_boost@@QAE_at_AAV?$basic_
>> istream_at_DU?$char_traits_at_D@std@@@std@@I_at_Z) referenced in function
>> "public: __thiscall rsg_text_iarchive::rsg_text_iarchive(class
>> std::basic_istream<char,struct std::char_traits<char> > &,unsigned
>> int)"
>> (??0rsg_text_iarchive@@QAE_at_AAV?$basic_istream_at_DU?$char_traits_at_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<char,struct
>> std::char_traits<char> > &,unsigned int)"
>> (??0?$text_oarchive_impl_at_Vrsg_text_oarchive@@@archive_at_boost@@QAE_at_AAV?$basic_
>> ostream_at_DU?$char_traits_at_D@std@@@std@@I_at_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<char,struct
>> std::char_traits<char> > &,unsigned int)"
>> (??0?$rsg_text_oarchive_impl_at_Vrsg_text_oarchive@@@@QAE_at_AAV?$basic_ostream_at_DU
>> ?$char_traits_at_D@std@@@std@@I_at_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_at_Vrsg_text_iarchive@@@archive_at_boost@@QAE
>> XAAUclass_name_type_at_23@H_at_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_at_archive@boost@@@?$interface_iarchive_at_Vrsg_text_iarchi
>> ve@@@detail_at_archive@boost@@QAEAAVrsg_text_iarchive@@AAUclass_name_type_at_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<char,struct
>> std::char_traits<char>,class std::allocator<char> > &)"
>> (?load@?$text_iarchive_impl_at_Vrsg_text_iarchive@@@archive_at_boost@@QAEXAAV?$bas
>> ic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_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<char,struct
>> std::char_traits<char>,class std::allocator<char> > >(class
>> rsg_text_iarchive &,class std::basic_string<char,struct
>> std::char_traits<char>,class std::allocator<char> > &)"
>> (??$load_primitive_at_Vrsg_text_iarchive@@V?$basic_string_at_DU?$char_traits_at_D@std
>> @@V?$allocator_at_D@2@@std@@@load_access_at_archive@boost@@SAXAAVrsg_text_iarchive
>> @@AAV?$basic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_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<char,struct
>> std::char_traits<char>,class std::allocator<char> > const &)"
>> (?save@?$text_oarchive_impl_at_Vrsg_text_oarchive@@@archive_at_boost@@QAEXABV?$bas
>> ic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_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<char,struct
>> std::char_traits<char>,class std::allocator<char> > >(class
>> rsg_text_oarchive &,class std::basic_string<char,struct
>> std::char_traits<char>,class std::allocator<char> > const &)"
>> (??$save_primitive_at_Vrsg_text_oarchive@@V?$basic_string_at_DU?$char_traits_at_D@std
>> @@V?$allocator_at_D@2@@std@@@save_access_at_archive@boost@@SAXAAVrsg_text_oarchive
>> @@ABV?$basic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_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_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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