Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Undefined reference to archive_serializer_map when creating my own archive type
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-06 14:47:03


Maxime van Noppen wrote:
>> Hi,
>>
>> I'm trying to create my own archive type and I'm struggling with this
>> error message :
>>
>>> $ g++ test.cc -lboost_serialization
>>> /tmp/cc5aW7rV.o: In function
>>> `boost::archive::detail::pointer_oserializer<sql_oarchive,
>>> internal::unit>::pointer_oserializer()':
>>> test.cc:(.text._ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEEC2Ev[_ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEEC5Ev]+0x4f):
>>> undefined reference to
>>> `boost::archive::detail::archive_serializer_map<sql_oarchive>::insert(boost::archive::detail::basic_serializer
>>> const*)' /tmp/cc5aW7rV.o: In function
>>> `boost::archive::detail::pointer_oserializer<sql_oarchive,
>>> internal::unit>::~pointer_oserializer()':
>>> test.cc:(.text._ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEED2Ev[_ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEED5Ev]+0x24):
>>> undefined reference to
>>> `boost::archive::detail::archive_serializer_map<sql_oarchive>::erase(boost::archive::detail::basic_serializer
>>> const*)'
>>
>> I can't find the relevant part of the documentation which talks about
>> it. Adding this piece of code makes the code compile but it doesn't
>> work:
>>
>>> namespace boost { namespace archive { namespace detail {
>>> template <>
>>> bool
>>> archive_serializer_map<sql_oarchive>::insert(boost::archive::detail::basic_serializer
>>> const*) { // ??
>>> }
>>>
>>> template <>
>>> void
>>> archive_serializer_map<sql_oarchive>::erase(boost::archive::detail::basic_serializer
>>> const*) { // ??
>>> }
>>> } } }
>>
>>
>> I'm using boost 1.43 on g++ 4.5 on linux 64bits. The code is
>> attached.
>>
>> What am I missing ?

Take a look at text_iarchive.cpp. In particular:

template class detail::archive_serializer_map<naked_text_iarchive>;
template class basic_text_iarchive<naked_text_iarchive> ;
template class text_iarchive_impl<naked_text_iarchive> ;
template class detail::archive_serializer_map<text_iarchive>;
template class basic_text_iarchive<text_iarchive> ;
template class text_iarchive_impl<text_iarchive> ;

Note the explicit instantiation of ...

Robert Ramey

>>
>> Thanks,
>>
>> --
>> Maxime
>>
>
>
>
>> _______________________________________________
>> 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