Boost logo

Boost Users :

Subject: Re: [Boost-users] How to choose which library version to choose?
From: Michael Kragh Pedersen (m_kragh_pedersen_at_[hidden])
Date: 2013-10-09 17:54:01


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_at_[hidden]
Subject: Re: [Boost-users] How to choose which library version to choose?

On Wed, Oct 9, 2013 at 11:31 AM, Michael Kragh Pedersen
<m_kragh_pedersen_at_[hidden]> 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::serialize<boost::archive::binary_oarchive>(boost::archive::binary_oarchive&,
> unsigned int)'
>
> Googling the error, I found this link:
>
> http://stackoverflow.com/questions/9795888/boost-serialization-using-separate-h-and-cpp-files
>
> 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 <boost/archive/binary_oarchive.hpp>
> #include <boost/archive/binary_iarchive.hpp>
>
> 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
>
> And I don’t see any difference between my code and the code in the
> documentation, besides the archive inclusions.
>
> From: Krzysztof Czainski
> Sent: Wednesday, October 09, 2013 3:43 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] How to choose which library version to choose?
>
> 2013/10/9 Michael Kragh Pedersen <m_kragh_pedersen_at_[hidden]>
>>
>> I have downloaded and built the Boost library, as according to these
>> instructions:
>>
>> http://theseekersquill.wordpress.com/2010/08/24/howto-boost-mingw/
>>
>> I need to use the serialization library, so I looked at the stage\lib
>> folder, only to 16 different library files! Some are named mt, some sd,
>> some
>> s or d, and some a combination thereof, all this following
>> libboost_serialization-mgw48. Some are dll files and some are a files.
>
>
> Those are different variants of the same library; you should choose one
> variant, and link to that variant only.
>
> -mt means multithreading
> -s means static (I think)
> -d means debug
> -sd probably means static debug
>
>>
>> I tried using –lboost_serialization, as I have seen this mentioned on a
>> lot of forums, but Eclipse says it can’t find that library. So how on
>> Earth
>> am I supposed to figure out which of the many files to link to?!
>
>
> If you want the static single-threading non-debug version, you probably
> need
> something like -lboost_serialization-s-mgw48 -LX:\path\to\boost\libs
>
> HTH,
> Kris
>
> ________________________________
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net