Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Undefined symbol
From: John Reid (j.reid_at_[hidden])
Date: 2011-02-16 08:26:09


On 16/02/11 09:47, John Reid wrote:
> On 15/02/11 20:09, Steven Watanabe wrote:
>> AMDG
>>
>> On 2/15/2011 11:43 AM, John Reid wrote:
>>> I'm trying to work on some code I haven't looked at in some time and in
>>> debug builds (with gcc 4.4.3) I keep getting an undefined symbol:
>>>
>>> boost::serialization::version<boost::multi_index::detail::serialization_version<bio::BindingHit<bio::BindingModel>
>>>
>>>
>>> > >::value
>>>
>>> I can't work out where this is getting referenced and why the compiler
>>> is not instantiating it there? Can anyone point me in the right
>>> direction? I'm using boost SVN revision 64053.
>>>
>>
>> Most likely, the out of line definition
>> was forgotten. It's easy to forget for
>> integral constants defined in the class
>> body because it often isn't needed.
>
Digging a bit deeper in the boost code I found the undefined symbol in
boost/serialization/version.hpp:

// default version number is 0. Override with higher version
// when class definition changes.
template<class T>
struct version
{
     template<class U>
     struct traits_class_version {
         typedef BOOST_DEDUCED_TYPENAME U::version type;
     };

     typedef mpl::integral_c_tag tag;
     // note: at least one compiler complained w/o the full qualification
     // on basic traits below
     typedef
         BOOST_DEDUCED_TYPENAME mpl::eval_if<
             is_base_and_derived<boost::serialization::basic_traits,T>,
             traits_class_version<T>,
             mpl::int_<0>
>::type type;
     BOOST_STATIC_CONSTANT(int, value = version::type::value);
};

Perhaps BOOST_STATIC_CONSTANT isn't working here? I know it seems a bit
unlikely. I've tried explicitly instantiating the template and defining
the symbol myself but I can't seem to get any of these approaches to
work. Why it would work in release mode but not debug is also a mystery
to me.

Any help appreciated. Thanks,
John.


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