Would you please help me with the issue below? I've tried 3 days without success.
The problem is with my serialization code. Whenever I try to instantiate the serialization, I encounter this error.
Can't load '/home/scratch.bipham_ctg100/generic_dev/scripts/x86_64-linux/auto/nDB/nDB.so' for module nDB: /home/scratch.bipham_ctg100/generic_dev/scripts/x86_64-linux/auto/nDB/nDB.so: undefined symbol: _ZTIN5boost7archive17archive_exceptionE at ...
Below is the code I wrote
// nDB CONSTRUCTOR
//**********************
nDB::nDB() {
//_LAYERS = new boost::unordered_map<string,layer,myhash,cmp_str>;
}
// nDB DESTRUCTOR
//**********************
nDB::~nDB() {}
// nDB METHODS
//**********************
//===============================================================
// SERIALIZATION DEFINITION AND INITIALIZATION
template<class Archive>
void nDB::serialize(Archive &ar, const unsigned int version) {
boost::unordered_map<string,macro*,myhash,cmp_str>::const_iterator _ITER;
for (_ITER = _MACROS.begin();_ITER != _MACROS.end();_ITER++) {
ar & _ITER->first;
ar & *(_ITER->second);
}
}
//template void nDB::serialize<boost::archive::binary_oarchive>(
// boost::archive::binary_oarchive & ar,
// const unsigned int version
//);
//template void nDB::serialize<boost::archive::binary_iarchive>(
// boost::archive::binary_iarchive & ar,
// const unsigned int version
//);
//================================================================
void nDB::save_macros(string filename) {
std::ofstream ofs(filename.c_str(), std::ios::out | std::ios::binary);
boost::archive::binary_oarchive oa(ofs);
oa << *this;
}
You need to link against the boost serialization library. Try adding
-lboost_serialization
to your linker flags.