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-16 01:06:54


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)

Vitaly Dolya wrote:
> Thanks for the response, Robert!
>
> Documentation didn't change a bit about it since boost 1.37, against
> which I was able to compile my code.
> Quote from the doc
> (http://www.boost.org/doc/libs/1_39_0/libs/serialization/doc/special.html#export):
> "Note that the implemenation of this functionality requires that the
>> BOOST_CLASS_EXPORT| macro appear *after* and the inclusion of any
> archive class headers for which code is to be instantiated.
> ...
>>> So, *the best way to use |BOOST_CLASS_EXPORT| is to include it in
>>> the
> same module which implements the class*."
>
> This is exactly as I did.
> This is what I have for standalone exe-application:
>
> 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>
> #include <boost/serialization/export.hpp>
>
> In SomeClass.cpp:
> #include "stdafx.h"
> #include "SomeClass.h"
> BOOST_CLASS_EXPORT(CSomeClass)
>
> Did I miss something?
>
> Robert Ramey wrote:
>> Check the documentation regarding BOOST_CLASS_EXPORT and the best
>> place to put it.


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