Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost 1.39][Serialization] BOOST_CLASS_EXPORT_GUID macro failed to compile with C2888 error under MSVS.
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-05-19 19:42:17


By design ? - lol - more like by default. The implemenation of
BOOST_CLASS_EXPORT is relies on creating a single static singleton for each
data type. Putting this in the header (inside an anonymous namespace?)
results in creating multiple such records so it's not a singleton anymore.
This leads to unintended consequences which I'm trying to figure out.

Robert Ramey

Vitaly Dolya wrote:
> Sorry for delayed answer, Robert.
>
> Yes, moving inclusion of export.hpp out of precompiled header helped.
> But the question remains... is it by design of Boost.Serialization,
> that I cann't
> include export.hpp explicitly or implicitly (through 3rd party
> library, for example)
> into application's precompiled header? Or should I claim Visual Studio
> compiler
> for the issue?
>
> Thanks for your help.
>
> Robert Ramey wrote:
>> Sorry, I didn't read your post carefully enough.
>>
>> Try the following:
>>
>>> In stdafx.h:
>>>
>> #include <boost/archive/binary_iarchive.hpp>
>> #include <boost/archive/binary_oarchive.hpp>
>> #include <boost/serialization/base_object.hpp>
>> #include <boost/serialization/vector.hpp>
>>
>> //In SomeClass.cpp:
>> #include "stdafx.h"
>> #include "SomeClass.h"
>> #include <boost/serialization/export.hpp>
>> BOOST_CLASS_EXPORT(CSomeClass)


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