Sign in to follow this  

boost::serialization compile problems

This topic is 3378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Using boost 1.35.0, GCC 4.2.3 on Ubuntu 8.04.1, I get the following compile errors for compiling the example program from the library documentation: http://www.boost.org/doc/libs/1_36_0/libs/serialization/example/demo.cpp
/usr/include/boost/serialization/utility.hpp|48|error: expected template-name before ‘<’ token|
/usr/include/boost/serialization/utility.hpp|48|error: expected `{' before ‘<’ token|
/usr/include/boost/serialization/utility.hpp|48|error: expected unqualified-id before ‘<’ token|
/usr/include/boost/archive/detail/oserializer.hpp||In member function ‘virtual bool boost::archive::detail::oserializer<Archive, T>::tracking(unsigned int) const’:|
/usr/include/boost/archive/detail/oserializer.hpp|121|error: ‘track_selectivly’ is not a member of ‘boost::serialization’|
/usr/include/boost/archive/detail/iserializer.hpp||In member function ‘virtual bool boost::archive::detail::iserializer<Archive, T>::tracking(unsigned int) const’:|
/usr/include/boost/archive/detail/iserializer.hpp|130|error: ‘track_selectivly’ is not a member of ‘boost::serialization’|



From /usr/include/boost/serialization/utility.hpp:
template <class T, class U>
struct is_bitwise_serializable<std::pair<T,U> >
 : public mpl::and_<is_bitwise_serializable<T>,is_bitwise_serializable<U> > //line 48
{
};



From /usr/include/boost/archive/detail/oserializer.hpp:
    virtual bool tracking(const unsigned int /* flags */) const {
//        if(0 != (flags &  no_tracking))
//            return false;
        return boost::serialization::tracking_level<T>::value == boost::serialization::track_always
            || boost::serialization::tracking_level<T>::value == boost::serialization::track_selectivly //line 121
            && serialized_as_pointer();
    }



From /usr/include/boost/archive/detail/iserializer.hpp:
    virtual bool tracking(const unsigned int /* flags */) const {
//        if(0 != (flags & no_tracking))
//            return false;
        return boost::serialization::tracking_level<T>::value 
                == boost::serialization::track_always
            || boost::serialization::tracking_level<T>::value 
                == boost::serialization::track_selectivly //line 130
            && serialized_as_pointer();
    }



What could be causing the problem? The word "selectivly" in iserializer/oserializer looks like a typo... Is there a dependency missing that utility.hpp needs...?

Share this post


Link to post
Share on other sites
Found a similar issue through the Google.

Essentially it says that the header file containing mpl::and_ is not being included and thus the error. This is what the start of the v1.36 utility.hpp should look like.


#ifndef BOOST_SERIALIZATION_UTILITY_HPP
#define BOOST_SERIALIZATION_UTILITY_HPP

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// serialization/utility.hpp:
// serialization for stl utility templates

// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// See http://www.boost.org for updates, documentation, and revision history.

#include <utility>
#include <boost/config.hpp>

#include <boost/type_traits/remove_const.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/mpl/and.hpp>

namespace boost {
namespace serialization {



The header file #include <boost/mpl/and.hpp> is where the issue is coming from.

So either just add the include to the header file or just go ahead and upgrade to the latest release of boost.

Share this post


Link to post
Share on other sites
EDIT: I upgraded to 1.36.0. Now I get a whole bunch of linker errors instead, I suppose that means boost::serialization is among the non-header only parts of boost and requires building...

Share this post


Link to post
Share on other sites
Those aren't compiler errors; they are linking errors. It seems like you haven't built and linked the boost::serialization library. Build the library (probably by using bjam) and then add it to your linker inputs.

Share this post


Link to post
Share on other sites

This topic is 3378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this