[Boost-Serialization] Problem with BOOST_CLASS_EXPORT

Hi, I'm getting conflicting declaration with BOOST_CLASS_EXPORT and I think I've got the reason. But I'm not aware of clean solution to overcome this. Let me explain the problem here. Say in FileAB.h, I've class A, class B defined. I've a FileSExportAB.h where I've BOOST_CLASS_EXPORT(A) at line say 10 and BOOST_CLASS_EXPORT(B) at line 11. Similarly I've class C and class D defined FileCD.h. And FileSExportCD.h has BOOST_CLASS_EXPORT(C) @ line 10 and BOOST_CLASS_EXPORT(D) @ line 11. And while building, I get error like following: ------------------------------------------------------------------------------------------------ FileSExportCD.h:10: error: conflicting declaration ‘const boost::archive::detail::guid_initializer<C>& <unnamed>::boost_serialization_guid_initializer_10’ FileSExportAB.h:10: error: ‘<unnamed>::boost_serialization_guid_initializer_10’ has a previous declaration as ‘const boost::archive::detail::guid_initializer & <unnamed>::boost_serialization_guid_initializer_10’ ------------------------------------------------------------------------------------------------ All A, B, C and D are in same namespace. Putting things at different namespace is overkill on legacy code. Is using BOOST_CLASS_EXPORT_GUID only better solution? Is it not pssible for boost to resolve it automatically with BOOST_CLASS_EXPORT macro? Regards, ~ Soumen -- View this message in context: http://www.nabble.com/-Boost-Serialization--Problem-with-BOOST_CLASS_EXPORT-... Sent from the Boost - Users mailing list archive at Nabble.com.

Soumen wrote:
Hi,
I'm getting conflicting declaration with BOOST_CLASS_EXPORT and I think I've got the reason. But I'm not aware of clean solution to overcome this. Let me explain the problem here.
Say in FileAB.h, I've class A, class B defined. I've a FileSExportAB.h where I've BOOST_CLASS_EXPORT(A) at line say 10 and BOOST_CLASS_EXPORT(B) at line 11.
Similarly I've class C and class D defined FileCD.h. And FileSExportCD.h has BOOST_CLASS_EXPORT(C) @ line 10 and BOOST_CLASS_EXPORT(D) @ line 11.
And while building, I get error like following:
------------------------------------------------------------------------------------------------ FileSExportCD.h:10: error: conflicting declaration ‘const boost::archive::detail::guid_initializer<C>& <unnamed>::boost_serialization_guid_initializer_10’ FileSExportAB.h:10: error: ‘<unnamed>::boost_serialization_guid_initializer_10’ has a previous declaration as ‘const boost::archive::detail::guid_initializer & <unnamed>::boost_serialization_guid_initializer_10’ ------------------------------------------------------------------------------------------------
All A, B, C and D are in same namespace. Putting things at different namespace is overkill on legacy code.
Is using BOOST_CLASS_EXPORT_GUID only better solution? Is it not pssible for boost to resolve it automatically with BOOST_CLASS_EXPORT macro?
Regards, ~ Soumen
Which version of boost are you using? I ran into this problem a few versions ago and a patch was submitted that fixes it.

Hmmm - what version of the serialization library is being used. I believe this has been fixed in recent versions. Also, you could move the BOOST_CLASS_EXPORT to the *.cpp files. Robert Ramey Soumen wrote:
Hi,
I'm getting conflicting declaration with BOOST_CLASS_EXPORT and I think I've got the reason. But I'm not aware of clean solution to overcome this. Let me explain the problem here.
Say in FileAB.h, I've class A, class B defined. I've a FileSExportAB.h where I've BOOST_CLASS_EXPORT(A) at line say 10 and BOOST_CLASS_EXPORT(B) at line 11.
Similarly I've class C and class D defined FileCD.h. And FileSExportCD.h has BOOST_CLASS_EXPORT(C) @ line 10 and BOOST_CLASS_EXPORT(D) @ line 11.
And while building, I get error like following:
------------------------------------------------------------------------------------------------ FileSExportCD.h:10: error: conflicting declaration 'const boost::archive::detail::guid_initializer<C>& <unnamed>::boost_serialization_guid_initializer_10' FileSExportAB.h:10: error: '<unnamed>::boost_serialization_guid_initializer_10' has a previous declaration as 'const boost::archive::detail::guid_initializer & <unnamed>::boost_serialization_guid_initializer_10' ------------------------------------------------------------------------------------------------
All A, B, C and D are in same namespace. Putting things at different namespace is overkill on legacy code.
Is using BOOST_CLASS_EXPORT_GUID only better solution? Is it not pssible for boost to resolve it automatically with BOOST_CLASS_EXPORT macro?
Regards, ~ Soumen

I'm using 1.35. -- View this message in context: http://www.nabble.com/-Boost-Serialization--Problem-with-BOOST_CLASS_EXPORT-... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (3)
-
Kenny Riddile
-
Robert Ramey
-
Soumen