"Oliver Kania" <kania.oliver@googlemail.com> wrote in message news:1262c4ee0711290739x12408875u39e54bbe9effb093@mail.gmail.com...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>(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 <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
For the class PaloClient, I do use the Pimpl idiom and serialize as it is recommended
in the documentation:
PaloClient.cpp:
--------------------------------------------------------------
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/scoped_ptr.hpp>
....
template<class Archive>
void PaloClient::serialize( Archive &ar, const unsigned int version ) {
ar & m_PaloClientImpl;
}
template void PaloClient::serialize<boost::archive::text_iarchive>(
boost::archive::text_iarchive & ar,
const unsigned int file_version
);
template void PaloClient::serialize<boost::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.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users