Boost logo

Boost :

Subject: [boost] [Serialization] this seems wrong
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2008-11-26 11:05:47


I'm somewhat inexperienced with boost serialization, so forgive me if
I'm just missing something. I have a few simple classes that are all
serializable. In each class's header, I have

BOOST_CLASS_EXPORT( ClassName )

right after the class declaration. All of these classes are
header-only, so there is no cpp. All of these classes are very similar,
so the statement above is often on the same line of the file (line 21 in
this case). When I include all of these headers in a single source
file, I get errors like this:

1>Win32WindowImpl.cpp
1>c:\subversion\trunk\vfx\platform\include\messages\minimized.hpp(21) :
error C2371:
'vfx::platform::`anonymous-namespace'::boost_serialization_guid_initializer_21'
: redefinition; different basic types
1> c:\subversion\trunk\vfx\platform\include\messages\close.hpp(21) : see
declaration of
'vfx::platform::`anonymous-namespace'::boost_serialization_guid_initializer_21'
1>c:\subversion\trunk\vfx\platform\include\messages\restored.hpp(21) :
error C2371:
'vfx::platform::`anonymous-namespace'::boost_serialization_guid_initializer_21'
: redefinition; different basic types
1> c:\subversion\trunk\vfx\platform\include\messages\close.hpp(21) : see
declaration of
'vfx::platform::`anonymous-namespace'::boost_serialization_guid_initializer_21'

I walked down into the BOOST_CLASS_EXPORT macro and saw that the
BOOST_CLASS_EXPORT_GUID macro appends the line number (notice the 21's
in the above compiler output) to what it generates. Thinking to myself,
"this will never work", I simply went and added empty lines to the
header files so that the BOOST_CLASS_EXPORT( ClassName ) was on a
different line in each and everything compiled. Am I missing something?
   Is this fixed in 1.37 (I'm currently forced to use 1.36). If I wanted
white-space to matter, I would be writing python :)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk