
On 10/9/2013 5:54 PM, Michael Kragh Pedersen wrote:
Michael, I've thought about the non-intrusive way too, but I can't use that as it doesn't work with private members from what I've understood. I did however try to remove the namespace from my code, which works, but then gives me the same error for forward_list and bitset, and from what I've read in the documentation, the STL collections should already have serialize methods within the boost library.
-----Original Message----- From: Michael Powell Sent: Wednesday, October 09, 2013 7:41 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] How to choose which library version to choose?
On Wed, Oct 9, 2013 at 11:31 AM, Michael Kragh Pedersen
wrote: Thank you, George and Krzysztof. The reason I asked about this is that I’m getting an error when trying to implement serialize into my class, and I thought this was due to the serialize template only being in one of the serialization libraries, thinking they all had different functions. The error I get is:
C:/boost_1_54_0/boost/serialization/access.hpp:118: undefined reference to `void boinc::work::Sudoku::serializeboost::archive::binary_oarchive(boost::archive::binary_oarchive&,
unsigned int)'
Googling the error, I found this link:
http://stackoverflow.com/questions/9795888/boost-serialization-using-separat...
Which mentions putting the definition into the header, which I’ve tried, but I still get the same error. So given the following code, can anyone tell me what I’m doing wrong?
Here's a thought: in my experience integrating with facets of the boost library, dealt with Spirit Qi at some length, and Phoenix and so forth tend to want things navigable from the global (::) namespace, it can be sensitive to namespace issues. friend class boost::serialization::access may not be able to find ::boinc::Sudoku, for example.
You might try non-intrusive serialization if that's an issue. Which is better SOLID style IMO anyway because it decouples the serialization know-how from the domain in the first place. Always a good thing; then the domain can update, the serialization could update, without either knowing the difference, necessarily.
#ifndef SUDOKU_HPP_ #define SUDOKU_HPP_
#include
#include namespace boinc { class Sudoku { friend class boost::serialization::access;
private: template<class Archive> void serialize(Archive &ar, const unsigned int version) { ... } }; } } #endif
I have been following the serialization tutorial here:
http://www.boost.org/doc/libs/1_54_0/libs/serialization/doc/tutorial.html
You might repost this with [serialization] in the subject, you'll probably get more help. That said can you actually build the example code? Jeff