Hi,
probably has been asked already thousand of times but I'm stuck
currently with some code:
Assuming I have the following files (The Base class Action is serialized
in the same way):
File: Ping.h
#include"Action.h"
classPing:publicAction{
public:
voidoperator()();
Ping();
Ping*clone()const;
~Ping();
template<typenameArchive>
voidserialize(Archive&ar,constunsignedint);
};
BOOST_CLASS_EXPORT_KEY2(Ping,"Ping");
File: Ping.cpp
#include"Ping.h"
#include<iostream>
#include
#include
#include
#include"Action.h"
#include"system.h"
#include"pong.h"
#include"serializerdeserializer.h"
#include"system.h"
#include"connection.h" #include"communication.h"
voidPing::operator()(){ }
Ping::Ping() { }
Ping*Ping::clone()const{
Ping*ping=newPing(*this);
returnping;
}
template<typenameArchive>
voidPing::serialize(Archive&ar,constunsignedint){
ar&BOOST_SERIALIZATION_BASE_OBJECT_NVP(Action); }
Ping::~Ping(){}
BOOST_CLASS_EXPORT_IMPLEMENT(Ping);
BOOST_CLASS_TRACKING(Ping,boost::serialization::track_never);
If I now compile the project into a library. And link this library to a
different project.
If I try to serialize the class now it doesn't work.
I get the following error:
unregistered class - derived class not registered or exported
According to the boost documentation I need to use
BOOST_CLASS_EXPORT_KEY in the header file and
BOOST_CLASS_EXPORT_IMPLEMENT in the corresponding cpp file.
What did I miss?
Regards,
Wolfgang