Boost logo

Boost Users :

Subject: [Boost-users] problems using serialization/export.hpp
From: Andrew Michael Levin (andrew.m.levin_at_[hidden])
Date: 2009-07-02 12:40:02


I am having problems compiling the following file called save_a.cc.

#include "save_a.hh"
#include <string>
#include <fstream>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/export.hpp>

BOOST_IS_ABSTRACT(space::A)
BOOST_CLASS_EXPORT(space::A)
BOOST_CLASS_EXPORT(space::B)
using namespace std;

namespace space {
void
save(const A* _a, const string& _filename) {
  std::ofstream ofs(_filename.c_str());
  OARCHIVE oa(ofs);
  oa & _a;
  ofs.close();
}

}

The errors that I get are as follows (I cut them off because they are
a lot of them):

[ 87%] Building CXX object src/shared/CMakeFiles/cryssmexlib.dir/test/save_a.o
cd "/home/My Name/cryssmex/src/shared" && /usr/bin/c++.exe
-Dcryssmexlib_EXPORTS -I/usr/include/boost-1_33_1 -I"/home/My
Name/cryssmex/cryssmex/src/shared" -Wall -o
CMakeFiles/cryssmexlib.dir/test/save_a.o -c "/home/My
Name/cryssmex/cryssmex/src/shared/test/save_a.cc"
/usr/include/boost-1_33_1/boost/serialization/export.hpp: In static
member function `static void
boost::archive::detail::guid_initializer<T>::export_register(const
char*) [with T = space::A]':
/usr/include/boost-1_33_1/boost/serialization/export.hpp:155:
instantiated from
`boost::archive::detail::guid_initializer<T>::guid_initializer(const
char*) [with T = space::A]'
/home/My Name/cryssmex/cryssmex/src/shared/test/save_a.cc:9:
instantiated from here
/usr/include/boost-1_33_1/boost/serialization/export.hpp:146: error:
incomplete type
`boost::serialization::extended_type_info_null<space::A>' used in
nested name specifier
/usr/include/boost-1_33_1/boost/serialization/export.hpp: In static
member function `static void
boost::archive::detail::guid_initializer<T>::export_register(const
char*) [with T = space::B]':
/usr/include/boost-1_33_1/boost/serialization/export.hpp:155:
instantiated from
`boost::archive::detail::guid_initializer<T>::guid_initializer(const
char*) [with T = space::B]'
/home/My Name/cryssmex/cryssmex/src/shared/test/save_a.cc:10:
instantiated from here
/usr/include/boost-1_33_1/boost/serialization/export.hpp:146: error:
incomplete type
`boost::serialization::extended_type_info_null<space::B>' used in
nested name specifier
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp: In
static member function `static void
boost::archive::detail::save_pointer_type<Archive,
TPtr>::save(Archive&, const T&, const
boost::archive::detail::basic_pointer_oserializer*) [with T =
space::A, Archive = boost::archive::text_oarchive, TPtr = const
space::A*]':
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:467:
instantiated from `static void
boost::archive::detail::save_pointer_type<Archive,
TPtr>::invoke(Archive&, TPtr) [with Archive =
boost::archive::text_oarchive, TPtr = const space::A*]'
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:536:
instantiated from `void boost::archive::save(Archive&, const T&) [with
Archive = boost::archive::text_oarchive, T = const space::A*]'
/usr/include/boost-1_33_1/boost/archive/basic_text_oarchive.hpp:78:
instantiated from `void
boost::archive::basic_text_oarchive<Archive>::save_override(T&, int)
[with T = const space::A* const, Archive =
boost::archive::text_oarchive]'
/usr/include/boost-1_33_1/boost/archive/detail/interface_oarchive.hpp:78:
  instantiated from `Archive&
boost::archive::detail::interface_oarchive<Archive>::operator<<(T&)
[with T = const space::A* const, Archive =
boost::archive::text_oarchive]'
/usr/include/boost-1_33_1/boost/archive/detail/interface_oarchive.hpp:86:
  instantiated from `Archive&
boost::archive::detail::interface_oarchive<Archive>::operator&(T&)
[with T = const space::A*, Archive = boost::archive::text_oarchive]'
/home/My Name/cryssmex/cryssmex/src/shared/test/save_a.cc:18:
instantiated from here
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:438:
error: invalid use of undefined type `struct
boost::serialization::extended_type_info_null<space::A>'
/usr/include/boost-1_33_1/boost/serialization/type_info_implementation.hpp:26:
error: declaration of `struct
boost::serialization::extended_type_info_null<space::A>'
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:439:
error: invalid use of undefined type `struct
boost::serialization::extended_type_info_null<space::A>'
/usr/include/boost-1_33_1/boost/serialization/type_info_implementation.hpp:26:
error: declaration of `struct
boost::serialization::extended_type_info_null<space::A>'
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:439:
error: `save' is not a member of `<declaration error>'
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp: In
static member function `static const
boost::archive::detail::basic_pointer_oserializer*
boost::archive::detail::save_pointer_type<Archive,
TPtr>::abstract<T>::register_type(Archive&) [with T = const space::A,
Archive = boost::archive::text_oarchive, TPtr = const space::A*]':
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:360:
instantiated from `static const
boost::archive::detail::basic_pointer_oserializer*
boost::archive::detail::save_pointer_type<Archive,
TPtr>::register_type(Archive&, T&) [with T = const space::A, Archive =
boost::archive::text_oarchive, TPtr = const space::A*]'
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:460:
instantiated from `static void
boost::archive::detail::save_pointer_type<Archive,
TPtr>::invoke(Archive&, TPtr) [with Archive =
boost::archive::text_oarchive, TPtr = const space::A*]'
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:536:
instantiated from `void boost::archive::save(Archive&, const T&) [with
Archive = boost::archive::text_oarchive, T = const space::A*]'
/usr/include/boost-1_33_1/boost/archive/basic_text_oarchive.hpp:78:
instantiated from `void
boost::archive::basic_text_oarchive<Archive>::save_override(T&, int)
[with T = const space::A* const, Archive =
boost::archive::text_oarchive]'
/usr/include/boost-1_33_1/boost/archive/detail/interface_oarchive.hpp:78:
  instantiated from `Archive&
boost::archive::detail::interface_oarchive<Archive>::operator<<(T&)
[with T = const space::A* const, Archive =
boost::archive::text_oarchive]'
/usr/include/boost-1_33_1/boost/archive/detail/interface_oarchive.hpp:86:
  instantiated from `Archive&
boost::archive::detail::interface_oarchive<Archive>::operator&(T&)
[with T = const space::A*, Archive = boost::archive::text_oarchive]'
/home/My Name/cryssmex/cryssmex/src/shared/test/save_a.cc:18:
instantiated from here
...
...

Any idea what the problem is?

Thanks.


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