[serialization] redefinition of ‘struct boost::archive::detail::init_guid<T>

Hi, I have something like the following object hierarchy: class Root {}; class A : Root {}; // BOOST_CLASS_EXPORT in header file class B : Root {}; // BOOST_CLASS_EXPORT in header file class U : A {}; // BOOST_CLASS_EXPORT in header file class V : A {}; // BOOST_CLASS_EXPORT in header file class X : B {}; // BOOST_CLASS_EXPORT in header file class Y : B {}; // BOOST_CLASS_EXPORT in header file There are a lot of shared pointers to the base classes Root, A and B which are to serialize.Boost 1.37 works fine while Boost 1.38 brings "redefinition of ‘struct boost::archive::detail::init_guid<A>" "redefinition of ‘struct boost::archive::detail::init_guid<B>" "redefinition of ‘struct boost::archive::detail::init_guid<U>" "redefinition of ‘struct boost::archive::detail::init_guid<V>" "redefinition of ‘struct boost::archive::detail::init_guid<X>" "redefinition of ‘struct boost::archive::detail::init_guid<Y>" after trying to link. It seems clear I have to put the BOOST_CLASS_EXPORT stuff in the belonging implementation files. But this corrupts the input of files which were created with the former binaries using the BOOST_CLASS_EXPORT in the header. I need an advice how and where the macro to place in terms of a long time decision. Below the class definition (which I find a good solution) seems no longer to work. Thank you very much, Jan.

Jan Boehme wrote:
It seems clear I have to put the BOOST_CLASS_EXPORT stuff in the belonging implementation files. But this corrupts the input of files which were created with the former binaries using the BOOST_CLASS_EXPORT in the header.
I don't think that it will. It should work the same.
I need an advice how and where the macro to place in terms of a long time decision. Below the class definition (which I find a good solution) seems no longer to work.
Thank you very much, Jan.
participants (2)
-
Jan Boehme
-
Robert Ramey