serialize explicit template instantiation

Hi,
I want to use a non inline serialize method of a class. When
instantiating it not explicitly the linker quits with undefined symbols.
So I tried to instantiate it that way and it does not work anyway.
Here is my code. Does anyone see what I've done wrong?
I did also try to use export.hpp but it doesn't help too.
Thank you very much, Jan.
// Class.hpp
#include

Try
///////////////////////// without effect
////////////////////////////////////
template void
CSerTest::serializeboost::archive::xml_oarchive(boost::archive::xml_oarchive&,
const unsigned int ); // add const !!!
Also a couple of unrelated suggestions:
// Class.hpp
// the following will bloat your code even whenever you use this header even
when not actually using
// xml_?archives - so better not to include it here:
//#include

Hi Robert,
On 11/29/06, Robert Ramey
Try
///////////////////////// without effect //////////////////////////////////// template void
CSerTest::serializeboost::archive::xml_oarchive(boost::archive::xml_oarchive&, const unsigned int ); // add const !!!
Of course I did try this but the unresolved symbol is of type CSerTest::serialize<class boost::archive::xml_oarchive>(class boost::archive::xml_oarchive &,unsigned int) and so I tried it without const. But the error occurs further. // main.cpp
#include <fstream> #include "Class.hpp"
#include
#include ///////////////////////// without effect //////////////////////////////////// template void
CSerTest::serializeboost::archive::xml_oarchive(boost::archive::xml_oarchive&, const unsigned int ); // "const" added!! to match template in declaration
int main() { const CSerTest instance; // check rationale on this.
std::ofstream ofs( "out_file.txt" ); boost::archive::xml_oarchive oxa( ofs );
oxa << BOOST_SERIALIZATION_NVP(instance); }
**** this should work.
I wish it would. Do you have another hint why the explicit instantiation doesn't work here? Thanks for your other suggestions. Cheers, jan

I just compiled, linked and ran the following program on my system:
vc 7.1
Boost 1.35 - HEAD
There was no need to explicitly instantiate anything.
Robert Ramey
#include

Hi Robert,
thank you for building the sample. I forgot to mention that I have to use
the 1.33.1. Sorry for that. I'm working under a 'stable release' constraint.
Cheers, Jan.
On 11/29/06, Robert Ramey
I just compiled, linked and ran the following program on my system:
vc 7.1 Boost 1.35 - HEAD
There was no need to explicitly instantiate anything.
Robert Ramey
participants (2)
-
Jan Boehme
-
Robert Ramey