Upgrading to Boost 1.35
This post is for geek eyes only. Pregnant programmers and people with weak stomachs for C++ templates should steer clear.
I decided to take the plunge tonight and upgrade my copy of Boost to 1.35. I had to fight through a couple of bugs when compiling with Visual Studio 2005, so I thought I’d share them here with the world.
Problem 1
Compiling code that serializes a map generated the following errors:
3>c:\dev\boost\boost\serialization\utility.hpp(48) : error C2039: 'and_' : is not a member of 'boost::mpl'
3> c:\dev\boost\boost\serialization\utility.hpp(50) : see reference to class template instantiation 'boost::serialization::is_bitwise_serializable<std::pair<_Ty1,_Ty2>>' being compiled
3>c:\dev\boost\boost\serialization\utility.hpp(48) : error C2504: 'and_' : base class undefined
3>c:\dev\boost\boost\serialization\utility.hpp(48) : error C2143: syntax error : missing ',' before '<'
Google confirmed that this one was a pretty simple fix. The file boost\serialization\utility.hpp
is missing a single include:
#include <boost/mpl/and.hpp>
Problem 2
Lots of errors when compiling a file with BOOST_CLASS_EXPORT_GUID:
1>C:\dev\boost\boost/serialization/type_info_implementation.hpp(48) : error C2027: use of undefined type 'boost::serialization::extended_type_info_impl<T>'
1> with
1> [
1> T=MyClass
1> ]
1> C:\dev\boost\boost/serialization/export.hpp(75) : see reference to class template instantiation 'boost::serialization::type_info_implementation<T>' being compiled
1> with
1> [
1> T=MyClass
1> ]
1> c:\dev\dreamcore\code\directx\MyClass.h(35) : see reference to class template instantiation 'boost::archive::detail::guid_initializer<T>' being compiled
1> with
1> [
1> T=MyClass
1> ]
And it goes on like that. A lot of template spew that can all be blamed on the ironically named extended_type_info_impl, since the compiler can’t find its implementation. I fixed these errors by throwing this line in export.hpp:
#include <boost/serialization/extended_type_info_typeid.hpp>
Now, I’m really not sure if extended_type_info_typeid
is the correct choice, or if it’s best to use extended_type_info_no_rtti.hpp
. All I know is that my serialization code compiles again, so I can get back to real coding.
No comments yet. Be the first.
Leave a reply