[serialization] Undefined reference to archive_serializer_map when creating my own archive type
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
::pointer_oserializer()': test.cc:(.text._ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEEC2Ev[_ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEEC5Ev]+0x4f): undefined reference to `boost::archive::detail::archive_serializer_map ::insert(boost::archive::detail::basic_serializer const*)' /tmp/cc5aW7rV.o: In function `boost::archive::detail::pointer_oserializer ::~pointer_oserializer()': test.cc:(.text._ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEED2Ev[_ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEED5Ev]+0x24): undefined reference to `boost::archive::detail::archive_serializer_map ::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
::insert(boost::archive::detail::basic_serializer const*) { // ?? } template <> void archive_serializer_map
::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 ? Thanks, -- Maxime
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
::pointer_oserializer()': test.cc:(.text._ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEEC2Ev[_ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEEC5Ev]+0x4f): undefined reference to `boost::archive::detail::archive_serializer_map ::insert(boost::archive::detail::basic_serializer const*)' /tmp/cc5aW7rV.o: In function `boost::archive::detail::pointer_oserializer ::~pointer_oserializer()': test.cc:(.text._ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEED2Ev[_ZN5boost7archive6detail19pointer_oserializerI12sql_oarchiveN8internal4unitEED5Ev]+0x24): undefined reference to `boost::archive::detail::archive_serializer_map ::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
::insert(boost::archive::detail::basic_serializer const*) { // ?? } template <> void archive_serializer_map
::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
Thanks,
-- Maxime
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 08/06/2010 08:47 PM, Robert Ramey wrote:
Take a look at text_iarchive.cpp. In particular:
template class detail::archive_serializer_map
; template class basic_text_iarchive ; template class text_iarchive_impl ; template class detail::archive_serializer_map ; template class basic_text_iarchive ; template class text_iarchive_impl ; Note the explicit instantiation of ...
It works, thank you! -- Maxime
participants (2)
-
Maxime van Noppen
-
Robert Ramey