Boost logo

Boost :

Subject: Re: [boost] [1.44][serialization] Link error with polymorphic archiveand BOOST_CLASS_EXPORT
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-01-21 18:08:02


Wilson Tim-CTW024 wrote:
> I've run into a conflict between use of the polymorphic archives and
> the BOOST_CLASS_EXPORT() macro. It doesn't seem possible to use both
> without getting a link error. The following code illustrates the
> problem (yes, I
> know this code doesn't do anything worth doing, but it's the simplest
> code that demonstrates the problem):
>
> ----------------------
>
> # include <sstream>
>
> # include <boost/serialization/export.hpp>
> # include <boost/archive/polymorphic_binary_oarchive.hpp>
>
> class A {
> public:
>
> template<class Archive>
> void serialize(Archive & ar, const unsigned version) {
> }
>
> };
>
> ///BOOST_CLASS_EXPORT(A); // need only for derived classes
>
>
>
> int main() {
>
> A a;
>
> std::ostringstream os(std::ios_binary); // make sure stream is opened
> binary
>// boost::archive::polymorphic_binary_oarchive oa(os);
> boost::archive::polymorphic_oarchive & oa =
> boost::archive::polymorphic_binary_oarchive(os);
> oa & a;
> }
>

Try the above changes.

Robert Ramey


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