Error: guid_defined is not template BOOST_CLASS_EXPORT_GUID
Hi I am using boost serialization and it was working fine (save load works) but then I tried using BOOST_CLASS_EXPORT_GUID and get weird error. The line that gives the error is this: BOOST_CLASS_EXPORT_GUID( Bakery, "Bakery") (I put the code in Cpp to avoid any problems with headers.) And this is the full Visual studio express 2010 error: 2>E:\boost_1_46_1\boost/archive/detail/check.hpp(162): error C2338: typex::value 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(577) : see reference to function template instantiation 'void boost::archive::detail::check_const_loading<T>(void)' being compiled 2> with 2> [ 2> T=const BuildingData 2> ] 2> E:\boost_1_46_1\boost/archive/detail/common_iarchive.hpp(66) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=const BuildingData 2> ] 2> E:\boost_1_46_1\boost/archive/basic_text_iarchive.hpp(65) : see reference to function template instantiation 'void boost::archive::detail::common_iarchive<Archive>::load_override<T>(T &,int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=const BuildingData 2> ] 2> E:\boost_1_46_1\boost/archive/text_iarchive.hpp(82) : see reference to function template instantiation 'void boost::archive::basic_text_iarchive<Archive>::load_override<T>(T &,int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=const BuildingData 2> ] 2> E:\boost_1_46_1\boost/archive/detail/interface_iarchive.hpp(60) : see reference to function template instantiation 'void boost::archive::text_iarchive_impl<Archive>::load_override<T>(T &,int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=const BuildingData 2> ] 2> E:\boost_1_46_1\boost/archive/detail/interface_iarchive.hpp(67) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><T>(T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=const BuildingData 2> ] 2> e:\projects\settlers\trunk\source\ai\../building.h(21) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator &<const BuildingData>(T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=const BuildingData 2> ] 2> E:\boost_1_46_1\boost/serialization/access.hpp(118) : see reference to function template instantiation 'void Building::serialize<Archive>(Archive &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive 2> ] 2> E:\boost_1_46_1\boost/serialization/serialization.hpp(69) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/serialization/serialization.hpp(128) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(192) : see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(170) : while compiling class template member function 'void boost::archive::detail::iserializer<Archive,T>::load_object_data(boost::archive::detail::basic_iarchive &,void *,const unsigned int) const' 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(392) : see reference to class template instantiation 'boost::archive::detail::iserializer<Archive,T>' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(439) : see reference to function template instantiation 'void boost::archive::detail::load_non_pointer_type<Archive>::load_standard::invoke<T>(Archive &,const T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(592) : see reference to function template instantiation 'void boost::archive::detail::load_non_pointer_type<Archive>::invoke<T>(Archive &,T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/common_iarchive.hpp(66) : see reference to function template instantiation 'void boost::archive::load<Archive,T>(Archive &,T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/basic_text_iarchive.hpp(65) : see reference to function template instantiation 'void boost::archive::detail::common_iarchive<Archive>::load_override<T>(T &,int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/text_iarchive.hpp(82) : see reference to function template instantiation 'void boost::archive::basic_text_iarchive<Archive>::load_override<T>(T &,int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/interface_iarchive.hpp(60) : see reference to function template instantiation 'void boost::archive::text_iarchive_impl<Archive>::load_override<T>(T &,int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/archive/detail/interface_iarchive.hpp(67) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator >><T>(T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> buildings\bakery.cpp(24) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_iarchive<Archive>::operator &<Building>(T &)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Building 2> ] 2> E:\boost_1_46_1\boost/serialization/access.hpp(118) : see reference to function template instantiation 'void Bakery::serialize<Archive>(Archive &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive 2> ] 2> E:\boost_1_46_1\boost/serialization/serialization.hpp(69) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Bakery 2> ] 2> E:\boost_1_46_1\boost/serialization/serialization.hpp(128) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Bakery 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(192) : see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Bakery 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(170) : while compiling class template member function 'void boost::archive::detail::iserializer<Archive,T>::load_object_data(boost::archive::detail::basic_iarchive &,void *,const unsigned int) const' 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Bakery 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(208) : see reference to class template instantiation 'boost::archive::detail::iserializer<Archive,T>' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Bakery 2> ] 2> E:\boost_1_46_1\boost/archive/detail/iserializer.hpp(205) : while compiling class template member function 'const boost::archive::detail::basic_iserializer &boost::archive::detail::pointer_iserializer<Archive,T>::get_basic_serializer(void) const' 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Bakery 2> ] 2> E:\boost_1_46_1\boost/serialization/export.hpp(66) : see reference to class template instantiation 'boost::archive::detail::pointer_iserializer<Archive,T>' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> T=Bakery 2> ] 2> E:\boost_1_46_1\boost/serialization/export.hpp(63) : while compiling class template member function 'const boost::archive::detail::basic_pointer_iserializer &boost::archive::detail::export_impl<Archive,Serializable>::enable_load(boost::mpl::true_)' 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> Serializable=Bakery 2> ] 2> E:\boost_1_46_1\boost/serialization/export.hpp(104) : see reference to class template instantiation 'boost::archive::detail::export_impl<Archive,Serializable>' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> Serializable=Bakery 2> ] 2> E:\boost_1_46_1\boost/serialization/export.hpp(103) : while compiling class template member function 'void boost::archive::detail::ptr_serialization_support<Archive,Serializable>::instantiate(void)' 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> Serializable=Bakery 2> ] 2> E:\boost_1_46_1\boost/archive/detail/register_archive.hpp(27) : see reference to class template instantiation 'boost::archive::detail::ptr_serialization_support<Archive,Serializable>' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> Serializable=Bakery 2> ] 2> E:\boost_1_46_1\boost/serialization/export.hpp(132) : see reference to class template instantiation 'boost::archive::detail::_ptr_serialization_support<Archive,Serializable>' being compiled 2> with 2> [ 2> Archive=boost::archive::text_iarchive, 2> Serializable=Bakery 2> ] 2> E:\boost_1_46_1\boost/serialization/export.hpp(128) : while compiling class template member function 'void boost::archive::detail::extra_detail::guid_initializer<T>::export_guid(boost::mpl::false_) const' 2> with 2> [ 2> T=Bakery 2> ] 2> buildings\bakery.cpp(76) : see reference to class template instantiation 'boost::archive::detail::extra_detail::guid_initializer<T>' being compiled 2> with 2> [ 2> T=Bakery 2> ] What is wrong? thx
Jari wrote:
Hi I am using boost serialization and it was working fine (save load works) but then I tried using BOOST_CLASS_EXPORT_GUID and get weird error.
The line that gives the error is this:
BOOST_CLASS_EXPORT_GUID( Bakery, "Bakery")
(I put the code in Cpp to avoid any problems with headers.)
And this is the full Visual studio express 2010 error:
2>E:\boost_1_46_1\boost/archive/detail/check.hpp(162): error C2338: typex::value
... what does the code look like at line 162 of check.hpp ? Robert Ramey
On Tue, May 10, 2011 at 8:57 AM, Robert Ramey <ramey@rrsd.com> wrote:
Jari wrote:
Hi I am using boost serialization and it was working fine (save load works) but then I tried using BOOST_CLASS_EXPORT_GUID and get weird error.
The line that gives the error is this:
BOOST_CLASS_EXPORT_GUID( Bakery, "Bakery")
(I put the code in Cpp to avoid any problems with headers.)
And this is the full Visual studio express 2010 error:
2>E:\boost_1_46_1\boost/archive/detail/check.hpp(162): error C2338: typex::value
...
what does the code look like at line 162 of check.hpp ?
Robert Ramey
Here's part of check.hpp where the problem is: template<class T> inline void check_const_loading(){ typedef BOOST_DEDUCED_TYPENAME mpl::or_< BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper< T >, BOOST_DEDUCED_TYPENAME mpl::not_< BOOST_DEDUCED_TYPENAME boost::is_const< T > > >::type typex; // cannot load data into a "const" object unless it's a // wrapper around some other non-const object. BOOST_STATIC_ASSERT(typex::value); // <------------- Compiler points here for the error } } // detail } // archive } // boost I must also say that I got all the code working in small test project but this error comes up in my big project.
On Tue, May 10, 2011 at 6:09 PM, Jari <jaristr@gmail.com> wrote:
On Tue, May 10, 2011 at 8:57 AM, Robert Ramey <ramey@rrsd.com> wrote:
Jari wrote:
Hi I am using boost serialization and it was working fine (save load works) but then I tried using BOOST_CLASS_EXPORT_GUID and get weird error.
The line that gives the error is this:
BOOST_CLASS_EXPORT_GUID( Bakery, "Bakery")
(I put the code in Cpp to avoid any problems with headers.)
And this is the full Visual studio express 2010 error:
2>E:\boost_1_46_1\boost/archive/detail/check.hpp(162): error C2338: typex::value
...
what does the code look like at line 162 of check.hpp ?
Robert Ramey
Here's part of check.hpp where the problem is:
template<class T> inline void check_const_loading(){ typedef BOOST_DEDUCED_TYPENAME mpl::or_< BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper< T >, BOOST_DEDUCED_TYPENAME mpl::not_< BOOST_DEDUCED_TYPENAME boost::is_const< T > > >::type typex; // cannot load data into a "const" object unless it's a // wrapper around some other non-const object. BOOST_STATIC_ASSERT(typex::value); // <------------- Compiler points here for the error }
} // detail } // archive } // boost
I must also say that I got all the code working in small test project but this error comes up in my big project.
Ok I found the problem. I was simply trying to save class that didnt have boost serialization cability/functions.
participants (2)
-
Jari
-
Robert Ramey