Change from binary_oarchive to text_oarchive gives 'sizeof' compilation errors

Hi, in trying to debug a problem we are experiencing here with binary archives I tried switching to text archives to see if we get the same behaviour. However, now I can't even compile my code! A straight swap for binary_oarchive to text_oarchive gives me these errors: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE<false>’ The arrangement of my header files is like so: // base_msg.h #include <boost/archive/tmpdir.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> using boost::archive::text_oarchive; using boost::archive::text_iarchive; class Base { private: text_oarchive out; text_iarchive in; }; template<class T> class MsgSerializer : public T, public Base { ... }; // msg.h #include "base_msg.h" // Boost containers, algorithms etc. #include <boost/serialization/map.hpp> #include <boost/serialization/string.hpp> #include <boost/serialization/vector.hpp> #include <boost/serialization/base_object.hpp> #include <boost/serialization/split_member.hpp> struct MyMsg_ { template<class Archive> void serialize(Archive &p_archiver, const unsigned int /* version */) { } }; typedef MsgSerializer<MyMsg_> MyMsg; etc. I have literally just changed binary_ for text_ and it now spits out said error whenever it encounters MyMsg_. This used to compile fine. Even if I re-arrange the headers I still get the same error? What must I change to get text_archives to compile!? I've also tried adding access.hpp (which I didn't have to do before) and serialization.hpp all to no avail. Regards, Jim -- James Vanns Systems Programmer Framestore CFC Ltd.

On 25 Sep 2008, at 11:12, James Vanns wrote:
Hi, in trying to debug a problem we are experiencing here with binary archives I tried switching to text archives to see if we get the same behaviour. However, now I can't even compile my code! A straight swap for binary_oarchive to text_oarchive gives me these errors:
error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE<false>’
The arrangement of my header files is like so:
You will need to send a complete code example that gives the error and tell us where the error appears.

I have found where it happens (after reading through a comment in a header file). For the text archive objects (but not for the binary for some reason) the object you wish to serialize/deconstruct must be const. Make this object const and the errors go away. Jim ----- Original Message ----- From: "Matthias Troyer" <troyer@phys.ethz.ch> To: boost-users@lists.boost.org Sent: Friday, 26 September, 2008 7:47:55 AM GMT +00:00 GMT Britain, Ireland, Portugal Subject: Re: [Boost-users] Change from binary_oarchive to text_oarchive gives 'sizeof' compilation errors On 25 Sep 2008, at 11:12, James Vanns wrote:
Hi, in trying to debug a problem we are experiencing here with binary archives I tried switching to text archives to see if we get the same behaviour. However, now I can't even compile my code! A straight swap for binary_oarchive to text_oarchive gives me these errors:
error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE<false>’
The arrangement of my header files is like so:
You will need to send a complete code example that gives the error and tell us where the error appears. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users -- James Vanns Systems Programmer Framestore CFC Ltd.
participants (2)
-
James Vanns
-
Matthias Troyer