|
Boost Users : |
From: nico35_at_[hidden]
Date: 2006-12-01 10:26:12
Hello,
I am using boost1.33.1 and spirit1.6 and borland c++ builder.
I have a compilation problem with the following source code.
The error message is
[C++ Error] void_cast.hpp(154): E2451 Undefined symbol 'get_instance'
[C++ Error] void_cast.hpp(155): E2451 Undefined symbol 'get_instance'
[C++ Error] void_cast.hpp(154): E2285 Could not find a match for
'void_caster::void_caster(undefined,undefined)'
Can anybody help me fixing this compilation problem ?
Than you in advance.
Marc.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <boost/serialization/utility.hpp>
// includes for xml serialization
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/basic_xml_oarchive.hpp>
#include <boost/archive/basic_xml_iarchive.hpp>
#include <boost/archive/impl/xml_iarchive_impl.ipp>
#include <boost/archive/impl/xml_oarchive_impl.ipp>
#include <boost/archive/impl/basic_xml_oarchive.ipp>
#include <boost/archive/impl/basic_xml_iarchive.ipp>
#include <boost/archive/basic_text_oprimitive.hpp>
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/impl/basic_text_oprimitive.ipp>
#include <boost/archive/impl/basic_text_iprimitive.ipp>
#include <boost/archive/impl/basic_xml_grammar.hpp>
#include <libs/serialization/src/basic_xml_grammar.ipp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include <boost/serialization/extended_type_info_typeid.hpp>
#include<iostream>
#include<fstream>
#include <vector>
#include <boost/serialization/vector.hpp>
class BaseClass
{
protected:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(m_degrees);
ar & BOOST_SERIALIZATION_NVP(m_minutes);
ar & BOOST_SERIALIZATION_NVP(m_seconds);
}
int m_degrees;
int m_minutes;
float m_seconds;
public:
BaseClass()
{
m_degrees = 0;
m_minutes = 0;
m_seconds = 0.0;
}
BaseClass(int degrees, int minutes, float seconds)
{
m_degrees = degrees;
m_minutes = minutes;
m_seconds = seconds;
}
virtual void display() const
{
std::cout << "------------------------------------" <<
std::endl;
std::cout << "m_degrees= " << m_degrees << std::endl;
std::cout << "m_minutes= " << m_minutes << std::endl;
std::cout << "m_seconds= " << m_seconds << std::endl;
std::cout << "------------------------------------" <<
std::endl;
}
};
BOOST_CLASS_TYPE_INFO(
BaseClass,
extended_type_info_no_rtti<BaseClass>
)
BOOST_CLASS_EXPORT(BaseClass)
class DerivedClass1: public BaseClass
{
protected:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(BaseClass);
// ar & BOOST_SERIALIZATION_NVP(m_vector);
}
mutable std::vector<int> m_vector;
public:
DerivedClass1(): BaseClass()
{
}
DerivedClass1(int degrees, int minutes, float seconds): BaseClass(degrees,
minutes, seconds)
{
}
void push_back(int arg) const
{
m_vector.push_back(arg);
}
virtual void display() const
{
std::cout <<
"***********************************************" << std::endl;
BaseClass::display();
for (std::vector<int>::const_iterator iter=m_vector.begin();
iter!=m_vector.end(); iter++)
{
std::cout << " value= " << *iter << std::endl;
}
std::cout <<
"***********************************************" << std::endl;
}
};
BOOST_CLASS_TYPE_INFO(
DerivedClass1,
extended_type_info_no_rtti<DerivedClass1>
)
BOOST_CLASS_EXPORT(DerivedClass1)
BOOST_CLASS_TYPE_INFO(
std::vector<double>,
extended_type_info_no_rtti<std::vector<double> >
)
BOOST_CLASS_EXPORT(std::vector<double>)
int main()
{
const DerivedClass1 g(35, 59, 24.567f);
g.push_back(10);
g.push_back(20);
g.push_back(30);
g.display();
{
std::ofstream ofs("filename");
boost::archive::xml_oarchive oa(ofs);
oa << boost::serialization::make_nvp("g1", g);
}
DerivedClass1 newg;
{
std::ifstream ifs("filename");
boost::archive::xml_iarchive ia(ifs);
ia >> boost::serialization::make_nvp("g1", newg);
}
newg.display();
return 0;
}
//---------------------------------------------------------------------------
/*
-------------------------------------------------------------
Noos, votre bureau virtuel sur Internet : Mail...
Web : webmail.noos.fr
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