Serialization demo.cpp: "Undefined reference to boost::archive::detail::basic_iarchive::load_object"
I'm using gcc v 3.3, Red Hat Linux (not sure what version), and Boost 1.32. I'm trying to learn the serialization library, using the demo program from http://boost.org/libs/serialization/example/demo.cpp . I have had a little bit of trouble figuring out the boost install procedure for this library but I think I finally did it with: bjam "-sTOOLS=gcc" install --libdir=/home/max/boost --includedir=/home/max/boost -with-serialization But when I execute "g++ -I/home/max/boost/boost-1_32 -L/home/max/boost demo.cpp demo.o" I get a bunch of linker errors. I'm pretty sure I've messed up this install procedure somewhere, and the Boost docs have tentalizing references to serialization not having "automatic linking," but I can't figure out where to go next. What am I doing wrong? Max Wilson -- Ubi solitudinem faciunt, pacem appellant. They make a desert and call it peace. -Tacitus
I have a similiar linux system to what you describe. I found that I needed to modify the Jamfile in $BOOST_ROOT/libs/serialization/example in order to build these files. Two changes: 1. Added demo_pimpl_A.cpp 2. Added libpthread.a The modified Jamfile is included. Maximilian Wilson wrote:
I'm using gcc v 3.3, Red Hat Linux (not sure what version), and Boost 1.32. I'm trying to learn the serialization library, using the demo program from http://boost.org/libs/serialization/example/demo.cpp .
I have had a little bit of trouble figuring out the boost install procedure for this library but I think I finally did it with:
bjam "-sTOOLS=gcc" install --libdir=/home/max/boost --includedir=/home/max/boost -with-serialization
But when I execute "g++ -I/home/max/boost/boost-1_32 -L/home/max/boost demo.cpp demo.o" I get a bunch of linker errors. I'm pretty sure I've messed up this install procedure somewhere, and the Boost docs have tentalizing references to serialization not having "automatic linking," but I can't figure out where to go next. What am I doing wrong?
Max Wilson
# Boost serialization Library Build Jamfile
# (C) Copyright Robert Ramey 2002-2004.
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# See http://www.boost.org/libs/serialization for the library home page.
subproject libs/serialization/example ;
rule demo-bsl-build ( demo-name )
{
exe $(demo-name)
: # sources
$(demo-name).cpp
demo_pimpl_A.cpp
<lib>../build/boost_serialization
: # requirements
<library-file>/usr/lib/libpthread.a
<include>$(BOOST_ROOT)
<sysinclude>$(BOOST_ROOT)
<borland><*><cxxflags>-w-8080
<msvc><release><cxxflags>-Gy
<vc7><release><cxxflags>-Gy
On Thu, 6 Jan 2005 18:08:37 -0600, Bill Lear
On Thursday, January 6, 2005 at 16:25:56 (-0700) Maximilian Wilson writes:
... But when I execute "g++ -I/home/max/boost/boost-1_32 -L/home/max/boost demo.cpp demo.o" I get a bunch of linker errors.
Did you forget to add -lboost_serialization-gcc ???
Forgot? No. Didn't do it? Yes. Haha, this is exactly what I've been looking for in the docs but couldn't quite find. Maybe an oversight in the serialization FAQ? Or maybe it's a purely gcc thing. Anyway, it works now. Thanks! Max Wilson -- Ubi solitudinem faciunt, pacem appellant. They make a desert and call it peace. -Tacitus
participants (3)
-
Bill Lear
-
Jeffrey Holle
-
Maximilian Wilson