Hi,
I am new to boost, but was able to get my own classes serialized.
However, when I include and try to
serialize a vector<int> I get the compile messages below. I must be
missing something.
class myclass2 : public Serializable<myclass2> // inherit Serializable
to become a serializable object
{
private:
// Override the serialize method, listing all variables to (un)serialize
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version) {
ar & mc;
ar & vint;
}
public:
myclass2() {};
~myclass2() {};
void Print() {
mc[0].Print();
mc[1].Print();
}
std::vector<int> vint;
myclass mc[2];
};
if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -Wall -I../../src
-I/ivlab/include -I/ivlab/include -I/usr/include/libxml2 -g -O2 -MT
test_serializable.o -MD -MP -MF ".deps/test_serializable.Tpo" -c -o
test_serializable.o test_serializable.cpp; \
then mv -f ".deps/test_serializable.Tpo" ".deps/test_serializable.Po";
else rm -f ".deps/test_serializable.Tpo"; exit 1; fi
distcc[6473] ERROR: compile
/home/alecg/.ccache/test_seria.tmp.hal.6469.ii on localhost failed
/usr/include/boost/archive/detail/oserializer.hpp: In constructor
‘boost::archive::detail::oserializer::oserializer() [with
Archive = boost::archive::text_oarchive, T = myclass]’:
/usr/include/boost/archive/detail/oserializer.hpp:135: instantiated from
‘static boost::archive::detail::oserializer&
boost::archive::detail::oserializer::instantiate() [with
Archive = boost::archive::text_oarchive, T = myclass]’
/usr/include/boost/archive/detail/oserializer.hpp:264: instantiated from
‘static void boost::archive::detail::save_non_pointer_type::save_standard::invoke(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = myclass]’
/usr/include/boost/archive/detail/oserializer.hpp:322: instantiated from
‘static void boost::archive::detail::save_non_pointer_type::invoke(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = myclass]’
/usr/include/boost/archive/detail/oserializer.hpp:536: instantiated from
‘void boost::archive::save(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = myclass]’
/usr/include/boost/archive/basic_text_oarchive.hpp:78: instantiated from
‘void boost::archive::basic_text_oarchive<Archive>::save_override(T&,
int) [with T = const myclass, Archive = boost::archive::text_oarchive]’
/usr/include/boost/archive/detail/interface_oarchive.hpp:78:
instantiated from ‘Archive&
boost::archive::detail::interface_oarchive<Archive>::operator<<(T&)
[with T = const myclass, Archive = boost::archive::text_oarchive]’
../Serializable.h:71: instantiated from ‘void
Serializable<T>::toStringStream(std::stringstream&) [with T = myclass]’
test_serializable.cpp:111: instantiated from here
/usr/include/boost/archive/detail/oserializer.hpp:107: error: incomplete
type ‘boost::serialization::extended_type_info_null<myclass>’ used in
nested name specifier
/usr/include/boost/archive/detail/oserializer.hpp: In constructor
‘boost::archive::detail::oserializer::oserializer() [with
Archive = boost::archive::text_oarchive, T = myclass2]’:
/usr/include/boost/archive/detail/oserializer.hpp:135: instantiated from
‘static boost::archive::detail::oserializer&
boost::archive::detail::oserializer::instantiate() [with
Archive = boost::archive::text_oarchive, T = myclass2]’
/usr/include/boost/archive/detail/oserializer.hpp:264: instantiated from
‘static void boost::archive::detail::save_non_pointer_type::save_standard::invoke(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = myclass2]’
/usr/include/boost/archive/detail/oserializer.hpp:322: instantiated from
‘static void boost::archive::detail::save_non_pointer_type::invoke(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = myclass2]’
/usr/include/boost/archive/detail/oserializer.hpp:536: instantiated from
‘void boost::archive::save(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = myclass2]’
/usr/include/boost/archive/basic_text_oarchive.hpp:78: instantiated from
‘void boost::archive::basic_text_oarchive<Archive>::save_override(T&,
int) [with T = const myclass2, Archive = boost::archive::text_oarchive]’
/usr/include/boost/archive/detail/interface_oarchive.hpp:78:
instantiated from ‘Archive&
boost::archive::detail::interface_oarchive<Archive>::operator<<(T&)
[with T = const myclass2, Archive = boost::archive::text_oarchive]’
../Serializable.h:71: instantiated from ‘void
Serializable<T>::toStringStream(std::stringstream&) [with T = myclass2]’
test_serializable.cpp:136: instantiated from here
/usr/include/boost/archive/detail/oserializer.hpp:107: error: incomplete
type ‘boost::serialization::extended_type_info_null<myclass2>’ used in
nested name specifier
/usr/include/boost/archive/detail/iserializer.hpp: In constructor
‘boost::archive::detail::iserializer::iserializer() [with
Archive = boost::archive::text_iarchive, T = myclass]’:
/usr/include/boost/archive/detail/iserializer.hpp:146: instantiated from
‘static boost::archive::detail::iserializer&
boost::archive::detail::iserializer::instantiate() [with
Archive = boost::archive::text_iarchive, T = myclass]’
/usr/include/boost/archive/detail/iserializer.hpp:375: instantiated from
‘static void boost::archive::detail::load_non_pointer_type::load_standard::invoke(Archive&, T&) [with Archive =
boost::archive::text_iarchive, T = myclass]’
/usr/include/boost/archive/detail/iserializer.hpp:425: instantiated from
‘static void boost::archive::detail::load_non_pointer_type::invoke(Archive&, T&) [with Archive = boost::archive::text_iarchive,
T = myclass]’
/usr/include/boost/archive/detail/iserializer.hpp:572: instantiated from
‘void boost::archive::load(Archive&, T&) [with Archive =
boost::archive::text_iarchive, T = myclass]’
/usr/include/boost/archive/basic_text_iarchive.hpp:64: instantiated from
‘void boost::archive::basic_text_iarchive<Archive>::load_override(T&,
int) [with T = myclass, Archive = boost::archive::text_iarchive]’
/usr/include/boost/archive/text_iarchive.hpp:64: instantiated from ‘void
boost::archive::text_iarchive_impl<Archive>::load_override(T&, int)
[with T = myclass, Archive = boost::archive::text_iarchive]’
/usr/include/boost/archive/detail/interface_iarchive.hpp:76:
instantiated from ‘Archive&
boost::archive::detail::interface_iarchive<Archive>::operator>>(T&)
[with T = myclass, Archive = boost::archive::text_iarchive]’
../Serializable.h:79: instantiated from ‘void
Serializable<T>::fromStringStream(std::stringstream&) [with T = myclass]’
test_serializable.cpp:115: instantiated from here
/usr/include/boost/archive/detail/iserializer.hpp:114: error: incomplete
type ‘boost::serialization::extended_type_info_null<myclass>’ used in
nested name specifier
/usr/include/boost/archive/detail/iserializer.hpp: In constructor
‘boost::archive::detail::iserializer::iserializer() [with
Archive = boost::archive::text_iarchive, T = myclass2]’:
/usr/include/boost/archive/detail/iserializer.hpp:146: instantiated from
‘static boost::archive::detail::iserializer&
boost::archive::detail::iserializer::instantiate() [with
Archive = boost::archive::text_iarchive, T = myclass2]’
/usr/include/boost/archive/detail/iserializer.hpp:375: instantiated from
‘static void boost::archive::detail::load_non_pointer_type::load_standard::invoke(Archive&, T&) [with Archive =
boost::archive::text_iarchive, T = myclass2]’
/usr/include/boost/archive/detail/iserializer.hpp:425: instantiated from
‘static void boost::archive::detail::load_non_pointer_type::invoke(Archive&, T&) [with Archive = boost::archive::text_iarchive,
T = myclass2]’
/usr/include/boost/archive/detail/iserializer.hpp:572: instantiated from
‘void boost::archive::load(Archive&, T&) [with Archive =
boost::archive::text_iarchive, T = myclass2]’
/usr/include/boost/archive/basic_text_iarchive.hpp:64: instantiated from
‘void boost::archive::basic_text_iarchive<Archive>::load_override(T&,
int) [with T = myclass2, Archive = boost::archive::text_iarchive]’
/usr/include/boost/archive/text_iarchive.hpp:64: instantiated from ‘void
boost::archive::text_iarchive_impl<Archive>::load_override(T&, int)
[with T = myclass2, Archive = boost::archive::text_iarchive]’
/usr/include/boost/archive/detail/interface_iarchive.hpp:76:
instantiated from ‘Archive&
boost::archive::detail::interface_iarchive<Archive>::operator>>(T&)
[with T = myclass2, Archive = boost::archive::text_iarchive]’
../Serializable.h:79: instantiated from ‘void
Serializable<T>::fromStringStream(std::stringstream&) [with T = myclass2]’
test_serializable.cpp:140: instantiated from here
/usr/include/boost/archive/detail/iserializer.hpp:114: error: incomplete
type ‘boost::serialization::extended_type_info_null<myclass2>’ used in
nested name specifier
/usr/include/boost/archive/detail/iserializer.hpp: In member function
‘bool boost::archive::detail::iserializer::is_polymorphic()
const [with Archive = boost::archive::text_iarchive, T = myclass2]’:
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/iserializer.hpp:142: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/archive/detail/iserializer.hpp:143: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/archive/detail/iserializer.hpp: In member function
‘bool boost::archive::detail::iserializer::is_polymorphic()
const [with Archive = boost::archive::text_iarchive, T = myclass]’:
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/iserializer.hpp:142: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/archive/detail/iserializer.hpp:143: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/archive/detail/oserializer.hpp: In member function
‘bool boost::archive::detail::oserializer::is_polymorphic()
const [with Archive = boost::archive::text_oarchive, T = myclass2]’:
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/oserializer.hpp:131: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/archive/detail/oserializer.hpp:132: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass2>’
/usr/include/boost/archive/detail/oserializer.hpp: In member function
‘bool boost::archive::detail::oserializer::is_polymorphic()
const [with Archive = boost::archive::text_oarchive, T = myclass]’:
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/oserializer.hpp:131: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/archive/detail/oserializer.hpp:132: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null<myclass>’
/usr/include/boost/archive/detail/oserializer.hpp: In constructor
‘boost::archive::detail::oserializer::oserializer() [with
Archive = boost::archive::text_oarchive, T = std::vector]’:
/usr/include/boost/archive/detail/oserializer.hpp:135: instantiated from
‘static boost::archive::detail::oserializer&
boost::archive::detail::oserializer::instantiate() [with
Archive = boost::archive::text_oarchive, T = std::vector]’
/usr/include/boost/archive/detail/oserializer.hpp:264: instantiated from
‘static void boost::archive::detail::save_non_pointer_type::save_standard::invoke(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = std::vector]’
/usr/include/boost/archive/detail/oserializer.hpp:273: instantiated from
‘static void boost::archive::detail::save_non_pointer_type::save_conditional::invoke(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = std::vector]’
/usr/include/boost/archive/detail/oserializer.hpp:322: instantiated from
‘static void boost::archive::detail::save_non_pointer_type::invoke(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = std::vector]’
/usr/include/boost/archive/detail/oserializer.hpp:536: instantiated from
‘void boost::archive::save(Archive&, const T&) [with Archive =
boost::archive::text_oarchive, T = std::vector]’
/usr/include/boost/archive/basic_text_oarchive.hpp:78: instantiated from
‘void boost::archive::basic_text_oarchive<Archive>::save_override(T&,
int) [with T = const std::vector, Archive =
boost::archive::text_oarchive]’
/usr/include/boost/archive/detail/interface_oarchive.hpp:78:
instantiated from ‘Archive&
boost::archive::detail::interface_oarchive<Archive>::operator<<(T&)
[with T = const std::vector, Archive =
boost::archive::text_oarchive]’
/usr/include/boost/archive/detail/interface_oarchive.hpp:86:
instantiated from ‘Archive&
boost::archive::detail::interface_oarchive<Archive>::operator&(T&) [with
T = std::vector, Archive =
boost::archive::text_oarchive]’
test_serializable.cpp:73: instantiated from ‘void
myclass2::serialize(Archive&, unsigned int) [with Archive =
boost::archive::text_oarchive]’
/usr/include/boost/serialization/access.hpp:109: instantiated from
‘static void boost::serialization::access::serialize(Archive&, T&,
unsigned int) [with Archive = boost::archive::text_oarchive, T = myclass2]’
/usr/include/boost/serialization/serialization.hpp:81: instantiated from
‘void boost::serialization::serialize(Archive&, T&, unsigned int) [with
Archive = boost::archive::text_oarchive, T = myclass2]’
/usr/include/boost/serialization/serialization.hpp:140: instantiated
from ‘void boost::serialization::serialize_adl(Archive&, T&, unsigned
int) [with Archive = boost::archive::text_oarchive, T = myclass2]’
/usr/include/boost/archive/detail/oserializer.hpp:148: instantiated from
‘void boost::archive::detail::oserializer::save_object_data(boost::archive::detail::basic_oarchive&, const
void*) const [with Archive = boost::archive::text_oarchive, T = myclass2]’
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/oserializer.hpp:107: error: incomplete
type ‘boost::serialization::extended_type_info_null >’ used in nested name specifier
/usr/include/boost/archive/detail/iserializer.hpp: In constructor
‘boost::archive::detail::iserializer::iserializer() [with
Archive = boost::archive::text_iarchive, T = std::vector]’:
/usr/include/boost/archive/detail/iserializer.hpp:146: instantiated from
‘static boost::archive::detail::iserializer&
boost::archive::detail::iserializer::instantiate() [with
Archive = boost::archive::text_iarchive, T = std::vector]’
/usr/include/boost/archive/detail/iserializer.hpp:375: instantiated from
‘static void boost::archive::detail::load_non_pointer_type::load_standard::invoke(Archive&, T&) [with Archive =
boost::archive::text_iarchive, T = std::vector]’
/usr/include/boost/archive/detail/iserializer.hpp:382: instantiated from
‘static void boost::archive::detail::load_non_pointer_type::load_conditional::invoke(Archive&, T&) [with Archive =
boost::archive::text_iarchive, T = std::vector]’
/usr/include/boost/archive/detail/iserializer.hpp:425: instantiated from
‘static void boost::archive::detail::load_non_pointer_type::invoke(Archive&, T&) [with Archive = boost::archive::text_iarchive,
T = std::vector]’
/usr/include/boost/archive/detail/iserializer.hpp:572: instantiated from
‘void boost::archive::load(Archive&, T&) [with Archive =
boost::archive::text_iarchive, T = std::vector]’
/usr/include/boost/archive/basic_text_iarchive.hpp:64: instantiated from
‘void boost::archive::basic_text_iarchive<Archive>::load_override(T&,
int) [with T = std::vector, Archive =
boost::archive::text_iarchive]’
/usr/include/boost/archive/text_iarchive.hpp:64: instantiated from ‘void
boost::archive::text_iarchive_impl<Archive>::load_override(T&, int)
[with T = std::vector, Archive =
boost::archive::text_iarchive]’
/usr/include/boost/archive/detail/interface_iarchive.hpp:76:
instantiated from ‘Archive&
boost::archive::detail::interface_iarchive<Archive>::operator>>(T&)
[with T = std::vector, Archive =
boost::archive::text_iarchive]’
/usr/include/boost/archive/detail/interface_iarchive.hpp:83:
instantiated from ‘Archive&
boost::archive::detail::interface_iarchive<Archive>::operator&(T&) [with
T = std::vector, Archive =
boost::archive::text_iarchive]’
test_serializable.cpp:73: instantiated from ‘void
myclass2::serialize(Archive&, unsigned int) [with Archive =
boost::archive::text_iarchive]’
/usr/include/boost/serialization/access.hpp:109: instantiated from
‘static void boost::serialization::access::serialize(Archive&, T&,
unsigned int) [with Archive = boost::archive::text_iarchive, T = myclass2]’
/usr/include/boost/serialization/serialization.hpp:81: instantiated from
‘void boost::serialization::serialize(Archive&, T&, unsigned int) [with
Archive = boost::archive::text_iarchive, T = myclass2]’
/usr/include/boost/serialization/serialization.hpp:140: instantiated
from ‘void boost::serialization::serialize_adl(Archive&, T&, unsigned
int) [with Archive = boost::archive::text_iarchive, T = myclass2]’
/usr/include/boost/archive/detail/iserializer.hpp:160: instantiated from
‘void boost::archive::detail::iserializer::load_object_data(boost::archive::detail::basic_iarchive&, void*,
unsigned int) const [with Archive = boost::archive::text_iarchive, T =
myclass2]’
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/iserializer.hpp:114: error: incomplete
type ‘boost::serialization::extended_type_info_null >’ used in nested name specifier
/usr/include/boost/archive/detail/iserializer.hpp: In member function
‘bool boost::archive::detail::iserializer::is_polymorphic()
const [with Archive = boost::archive::text_iarchive, T =
std::vector]’:
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/iserializer.hpp:142: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null >’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null >’
/usr/include/boost/archive/detail/iserializer.hpp:143: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null >’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null >’
/usr/include/boost/archive/detail/oserializer.hpp: In member function
‘bool boost::archive::detail::oserializer::is_polymorphic()
const [with Archive = boost::archive::text_oarchive, T =
std::vector]’:
test_serializable.cpp:147: instantiated from here
/usr/include/boost/archive/detail/oserializer.hpp:131: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null >’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null >’
/usr/include/boost/archive/detail/oserializer.hpp:132: error: invalid
use of undefined type ‘struct
boost::serialization::extended_type_info_null >’
/usr/include/boost/serialization/type_info_implementation.hpp:26: error:
declaration of ‘struct
boost::serialization::extended_type_info_null >’
make[4]: *** [test_serializable.o] Error 1
make[4]: Leaving directory `/home/alecg/Software/ivlab3/objects/src/tests'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/alecg/Software/ivlab3/objects/src/tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/alecg/Software/ivlab3/objects/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/alecg/Software/ivlab3/objects'
make: *** [all] Error 2
alec