Hello !
When linking a program that consists only of main.cpp with a library that
serializes
a class "Palo Cllient" I get the following message (sry for the mess):
==================================================
error LNK2019: unresolved external symbol "private: void __thiscall
jedox::palo::PaloClient::serialize<class
boost::archive::text_oarchive>(class boost::archive::text_oarchive
&,unsigned int)" (??$serialize@ Vtext_oarchive@archive@boost@@@
PaloClient@palo@jedox@@AAEXAAVtext_oarchive@archive@boost@@I@Z) referenced
in function "public: static void __cdecl
boost::serialization::access::serialize(class
boost::archive::text_oarchive &,class jedox::palo::PaloClient &,unsigned
int)" (??$serialize@ Vtext_oarchive@archive@boost@@VPaloClient@palo@jedox@@@
access@serialization@boost@@SAXAAVtext_oarchive@archive@2@AAVPaloClient@
palo@jedox@@I@Z)
==================================================
This happens even though I do NOT explicitly serialize anything.
Main.cpp includes:
#include
#include
For the class PaloClient, I do use the Pimpl idiom and serialize as it is
recommended
in the documentation:
PaloClient.cpp:
--------------------------------------------------------------
#include
#include
#include
....
template<class Archive>
void PaloClient::serialize( Archive &ar, const unsigned int version
) {
ar & m_PaloClientImpl;
}
template void PaloClient::serializeboost::archive::text_iarchive(
boost::archive::text_iarchive & ar,
const unsigned int file_version
);
template void PaloClient::serializeboost::archive::text_oarchive(
boost::archive::text_oarchive & ar,
const unsigned int file_version
);
------------------------------------------------------------------------
Now, when I change this to
void PaloClient::serialize(boost::archive::text_iarchive & ar, const
unsigned int file_version) {
ar & m_PaloClientImpl;
}
void PaloClient::serialize (boost::archive::text_oarchive & ar,
const unsigned int file_version) {
ar & m_PaloClientImpl;
}
The linkage error disappears. I guess this is a Visual C++ compiler problem
but
I wanted to post this in case someone else has similar problems.
Kind regards, Oliver
PS: Thanks for this great serialization library, it saved me many weeks of
programming.