Boost logo

Boost Users :

Subject: [Boost-users] [serialization] Can't build first example from docs.
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2009-12-25 18:19:41


Help! And thanks:) Same error as on our code. I thought I'd go through
all the documentation (BTW do you want notes on typos?) and come up to
speed so I could figure out why our code (that someone else wrote), had
this error. To my surprise, the first example I tried had the same no
get_debug_info member error. What am I doing wrong?

Using trunk
Using gcc 4.4.1 or 4.5
Linux dell 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 16:20:31 UTC 2009
i686 GNU/Linux

make example1
g++ -ggdb -ansi -pedantic -Wextra -Wwrite-strings -Wformat=2 -Wall
-fstrict-aliasing -O3 -Wstrict-aliasing=3 -std=c++0x example1.cpp -o
example1
In file included from
/usr/local/include/boost/archive/detail/abi_prefix.hpp:11,
from /usr/local/include/boost/archive/shared_ptr_helper.hpp:35,
from /usr/local/include/boost/archive/text_iarchive.hpp:100,
from example1.cpp:5:
/usr/local/include/boost/config/abi_prefix.hpp:12:3: error: #error
double inclusion of header boost/config/abi_prefix.hpp is an error
In file included from
/usr/local/include/boost/archive/detail/abi_suffix.hpp:14,
from /usr/local/include/boost/archive/text_iarchive.hpp:122,
from example1.cpp:5:
/usr/local/include/boost/config/abi_suffix.hpp:13:3: error: #error
Header boost/config/abi_suffix.hpp must only be used after
boost/config/abi_prefix.hpp
In file included from
/usr/local/include/boost/archive/detail/interface_oarchive.hpp:24,
from /usr/local/include/boost/archive/detail/common_oarchive.hpp:20,
from /usr/local/include/boost/archive/basic_text_oarchive.hpp:32,
from /usr/local/include/boost/archive/text_oarchive.hpp:31,
from example1.cpp:4:
/usr/local/include/boost/archive/detail/oserializer.hpp: In static
member function ‘static void
boost::archive::detail::save_pointer_type<Archive>::polymorphic::save(Archive&,
T&)’:
/usr/local/include/boost/archive/detail/oserializer.hpp:441: error:
‘const class boost::archive::detail::basic_pointer_oserializer’ has no
member named ‘get_debug_info’
In file included from
/usr/local/include/boost/archive/detail/interface_iarchive.hpp:23,
from /usr/local/include/boost/archive/detail/common_iarchive.hpp:23,
from /usr/local/include/boost/archive/basic_text_iarchive.hpp:31,
from /usr/local/include/boost/archive/text_iarchive.hpp:24,
from example1.cpp:5:
/usr/local/include/boost/archive/detail/iserializer.hpp: In member
function ‘virtual void boost::archive::detail::iserializer<Archive,
T>::load_object_data(boost::archive::detail::basic_iarchive&, void*,
unsigned int) const’:
/usr/local/include/boost/archive/detail/iserializer.hpp:176: error:
there are no arguments to ‘get_debug_info’ that depend on a template
parameter, so a declaration of ‘get_debug_info’ must be available
/usr/local/include/boost/archive/detail/iserializer.hpp:176: note: (if
you use ‘-fpermissive’, G++ will accept your code, but allowing the use
of an undeclared name is deprecated)
/usr/local/include/boost/archive/detail/iserializer.hpp: In member
function ‘void boost::archive::detail::iserializer<Archive,
T>::load_object_data(boost::archive::detail::basic_iarchive&, void*,
unsigned int) const [with Archive = boost::archive::text_iarchive, T =
gps_position]’:
example1.cpp:62: instantiated from here
/usr/local/include/boost/archive/detail/iserializer.hpp:173: error:
‘get_debug_info’ was not declared in this scope
example1.cpp: At global scope:
example1.cpp: In instantiation of ‘void
gps_position::serialize(Archive&, unsigned int) [with Archive =
boost::archive::text_iarchive]’:
/usr/local/include/boost/serialization/access.hpp:118: instantiated from
‘static void boost::serialization::access::serialize(Archive&, T&,
unsigned int) [with Archive = boost::archive::text_iarchive, T =
gps_position]’
/usr/local/include/boost/serialization/serialization.hpp:74:
instantiated from ‘void boost::serialization::serialize(Archive&, T&,
unsigned int) [with Archive = boost::archive::text_iarchive, T =
gps_position]’
/usr/local/include/boost/serialization/serialization.hpp:133:
instantiated from ‘void boost::serialization::serialize_adl(Archive&,
T&, unsigned int) [with Archive = boost::archive::text_iarchive, T =
gps_position]’
/usr/local/include/boost/archive/detail/iserializer.hpp:182:
instantiated from ‘void boost::archive::detail::iserializer<Archive,
T>::load_object_data(boost::archive::detail::basic_iarchive&, void*,
unsigned int) const [with Archive = boost::archive::text_iarchive, T =
gps_position]’
example1.cpp:62: instantiated from here
example1.cpp:20: warning: unused parameter ‘version’
example1.cpp: In instantiation of ‘void
gps_position::serialize(Archive&, unsigned int) [with Archive =
boost::archive::text_oarchive]’:
/usr/local/include/boost/serialization/access.hpp:118: instantiated from
‘static void boost::serialization::access::serialize(Archive&, T&,
unsigned int) [with Archive = boost::archive::text_oarchive, T =
gps_position]’
/usr/local/include/boost/serialization/serialization.hpp:74:
instantiated from ‘void boost::serialization::serialize(Archive&, T&,
unsigned int) [with Archive = boost::archive::text_oarchive, T =
gps_position]’
/usr/local/include/boost/serialization/serialization.hpp:133:
instantiated from ‘void boost::serialization::serialize_adl(Archive&,
T&, unsigned int) [with Archive = boost::archive::text_oarchive, T =
gps_position]’
/usr/local/include/boost/archive/detail/oserializer.hpp:148:
instantiated from ‘void boost::archive::detail::oserializer<Archive,
T>::save_object_data(boost::archive::detail::basic_oarchive&, const
void*) const [with Archive = boost::archive::text_oarchive, T =
gps_position]’
example1.cpp:62: instantiated from here
example1.cpp:20: warning: unused parameter ‘version’
make: *** [example1] Error 1

example.cpp is the first example in the serialization docs, reproduced
here for completeness:

#include <fstream>

// include headers that implement a archive in simple text format
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

/////////////////////////////////////////////////////////////
// gps coordinate
//
// illustrates serialization for a simple type
//
class gps_position
{
private:
friend class boost::serialization::access;
// When the class Archive corresponds to an output archive, the
// & operator is defined similar to <<. Likewise, when the class Archive
// is a type of input archive the & operator is defined similar to >>.
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & degrees;
ar & minutes;
ar & seconds;
}
int degrees;
int minutes;
float seconds;
public:
gps_position(){};
gps_position(int d, int m, float s) :
degrees(d), minutes(m), seconds(s)
{}
};

int main() {
// create and open a character archive for output
std::ofstream ofs("filename");

// create class instance
const gps_position g(35, 59, 24.567f);

// save data to archive
{
boost::archive::text_oarchive oa(ofs);
// write class instance to archive
oa << g;
// archive and stream closed when destructors are called
}

// ... some time later restore the class instance to its orginal state
gps_position newg;
{
// create and open an archive for input
std::ifstream ifs("filename");
boost::archive::text_iarchive ia(ifs);
// read class state from archive
ia >> newg;
// archive and stream closed when destructors are called
}
return 0;
}


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