Boost logo

Boost :

From: áÌÅËÓÅÊ ïÂÕÈÏ× (obukhoff_at_[hidden])
Date: 2006-03-11 05:24:45


    Hello all !

 I write small test program using boost::serialization.
If I use boost 1.32 - compilation OK. But I change boost to 1.33.1 -
compiler rise error :(

Where I be mistaken ?

Compiler messages:

OtherTest.cpp
w:\Devil\Projects\PLTools2_boost_1.33.1\boost\boost\serialization\export.hpp(146)
: error C2027: use of undefined type
'boost::serialization::extended_type_info_null'
with
[
T=BoostTest2::A
]
w:\Devil\Projects\PLTools2_boost_1.33.1\boost\boost\serialization\export.hpp(146)
: see reference to class template instantiation
'boost::serialization::extended_type_info_null' being compiled
with
[
T=BoostTest2::A
]
w:\Devil\Projects\PLTools2_boost_1.33.1\boost\boost\serialization\export.hpp(145)
: while compiling class-template member function 'void
boost::archive::detail::guid_initializer::export_register(const char *)'
with
[
T=BoostTest2::A
]
w:\Devil\Projects\PLTools2_boost_1.33.1\Tests\OtherTest\boost_test_2.h(64) :
see reference to class template instantiation
'boost::archive::detail::guid_initializer' being compiled
with
[
T=BoostTest2::A
]
Results

This error point to line: (full code below)

BOOST_CLASS_EXPORT_GUID( BoostTest2::B, "ClassB" )

OtherTest.cpp:

#include <iostream>
#include <sstream>

#include <boost/serialization/vector.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/nvp.hpp>

#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>

#include <boost/serialization/export.hpp>
#include <boost/serialization/base_object.hpp>

#include "boost_test_2.h"
using namespace BoostTest2;

/// .....

boost_test_2.h

#pragma once

namespace BoostTest2
{

class A
{
public:
    A() {m_A = 1;}
    virtual ~A() { }

    int m_A;
};

class B : public A
{
public:
    B() {m_B = 2;}
    virtual ~B() {}

    int m_B;
};

class C : public A
{
public:
    C() {m_C = 3;}
    virtual ~C() {}

    int m_C;
};

}

#define BOOST_NVP(name,value) \
    boost::serialization::make_nvp(name, value)

namespace boost {
namespace serialization {

    template<class Archive>
    void serialize(Archive & ar, BoostTest2::A &a, const unsigned int version)
    {
        ar & BOOST_NVP( "A", a.m_A );
    }
    template<class Archive>
        void serialize(Archive & ar, BoostTest2::B &b, const unsigned
int version)
    {
        ar & boost::serialization::make_nvp( "A",
boost::serialization::base_object<A>(b) );
        ar & BOOST_NVP( "B", b.m_B );
    }
    template<class Archive>
        void serialize(Archive & ar, BoostTest2::C &c, const unsigned
int version)
    {
        ar & boost::serialization::make_nvp( "A",
boost::serialization::base_object<A>(c) );
        ar & BOOST_NVP( "C", c.m_C );
    }
}
}

BOOST_CLASS_EXPORT_GUID( BoostTest2::B, "ClassB" )
BOOST_CLASS_EXPORT_GUID( BoostTest2::C, "ClassC" )

BOOST_IS_ABSTRACT( BoostTest2::A )

BOOST_CLASS_VERSION( BoostTest2::A , 0 )


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