Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization, mpl: BOOST_CLASS_VERSION() macro causes gcc compile errors with Boost version 1.43
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-06-24 16:16:18


Clarke, Carus V wrote:
> Using Boost version 1.43 to compile my project caused the following
> errors to occur. There are more, but they are essentially the same:
>
> I was able to verify that these were caused by the
> BOOST_CLASS_VERSION macro appearing on the same line in two or more
> files included by the file being compiled. Using the
> BOOST_PP_COUNTER from the preprocessor library as the argument to a
> #line directive on the line preceding the BOOST_PP_COUNTER macro can
> be used as a workaround. Another was to disable the MPL assertion in
> the body of the macro. For class versioning to work for gcc, the
> BOOST_PP_COUNTER macro has to appear in a header file, and I think it
> is better to put it in the header files for the classes to be
> serialized.
>
> Here is a sample of the workaround:
>
> // the next two lines are needed to prevent compile-time errors with
> gcc #include BOOST_PP_UPDATE_COUNTER()
> #line BOOST_PP_COUNTER
> BOOST_CLASS_VERSION(Calculation, 0)
>
> Is there a better way to handle the problem? Is this a bug?

Hmmmm - this will require some thought. The best thing would be to open up
a track item for this so it doesn't get forgotten.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net