|
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 12:31:54
Thank you, George and Krzysztof. The reason I asked about this is that Im 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 Ive tried, but I still get the same error. So given the following code, can anyone tell me what Im doing wrong?
#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 dont 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 cant 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 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