Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

portable archive not compiling under GCC

I need to (de)serialize data on both Windows and Linux (and transfer the files in between). I wanted to use the portable binary archives of Boost's serialization library which can be found in the examples, see e.g. at http://boost-doc-zh.googlecode.com/svn-history/r380/trunk/libs/serialization/example/

This works fine on Windows (VS 2008) but fails to compile under GCC 4.3.2 with the following errors.

Can anybody suggest a solution?

Thanks a lot!

/projects/lib/BOOST/1_44_0/include/boost/archive/basic_archive.hpp: In member function 'void portable_binary_iarchive::init(unsigned int)':
/projects/lib/BOOST/1_44_0/include/boost/archive/basic_archive.hpp:78: error: 'uint_least32_t boost::archive::version_type::t' is private
/home/myfolder/src/portable_binary_iarchive.cpp:92: error: within this context
/home/myfolder/src/portable_binary_iarchive.hpp: In member function 'void portable_binary_iarchive::load(T&) [with T = boost::archive::class_id_type]':
/projects/lib/BOOST/1_44_0/include/boost/archive/detail/iserializer.hpp:107:   instantiated from 'static void boost::archive::load_access::load_primitive(Archive&, T&) [with Archive = portable_binary_iarchive, T = boost::archive::class_id_type]'
/projects/lib/BOOST/1_44_0/include/boost/archive/detail/iserializer.hpp:356:   instantiated from 'static void boost::archive::detail::load_non_pointer_type<Archive>::load_primitive::invoke(Archive&, T&) [with T = boost::archive::class_id_type, Archive = portable_binary_iarchive]'
/projects/lib/BOOST/1_44_0/include/boost/archive/detail/iserializer.hpp:433:   instantiated from 'static void boost::archive::detail::load_non_pointer_type<Archive>::invoke(Archive&, T&) [with T = boost::archive::class_id_type, Archive = portable_binary_iarchive]'
/projects/lib/BOOST/1_44_0/include/boost/archive/detail/iserializer.hpp:586:   instantiated from 'void boost::archive::load(Archive&, T&) [with Archive = portable_binary_iarchive, T = boost::archive::class_id_type]'
/projects/lib/BOOST/1_44_0/include/boost/archive/detail/common_iarchive.hpp:66:   instantiated from 'void boost::archive::detail::common_iarchive<Archive>::load_override(T&, int) [with T = boost::archive::class_id_type, Archive = portable_binary_iarchive]'
/home/myfolder/src/portable_binary_iarchive.hpp:140:   instantiated from 'void portable_binary_iarchive::load_override(T&, int) [with T = boost::archive::class_id_type]'
/projects/lib/BOOST/1_44_0/include/boost/archive/detail/interface_iarchive.hpp:60:   instantiated from 'Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = boost::archive::class_id_type, Archive = portable_binary_iarchive]'
/projects/lib/BOOST/1_44_0/include/boost/archive/detail/common_iarchive.hpp:51:   instantiated from 'void boost::archive::detail::common_iarchive<Archive>::vload(boost::archive::class_id_type&) [with Archive = portable_binary_iarchive]'
/home/myfolder/src/portable_binary_iarchive.cpp:128:   instantiated from here
/home/myfolder/src/portable_binary_iarchive.hpp:107: error: call of overloaded 'class_id_type(intmax_t&)' is ambiguous
/projects/lib/BOOST/1_44_0/include/boost/archive/basic_archive.hpp:118: note: candidates are: boost::archive::class_id_type::class_id_type(size_t)
/projects/lib/BOOST/1_44_0/include/boost/archive/basic_archive.hpp:115: note:                 boost::archive::class_id_type::class_id_type(int)
like image 729
Philipp Avatar asked Apr 21 '11 13:04

Philipp


1 Answers

Not really a direct answer to your question, but I've had a lot of success with Google's Protocol Buffers. They use them internally and open sourced them: http://code.google.com/p/protobuf/

like image 129
Smokey.Canoe Avatar answered Oct 17 '22 06:10

Smokey.Canoe