Boost logo

Boost Users :

From: Mike P (mikebabble_at_[hidden])
Date: 2005-07-06 22:20:56


I've DL'ed and installed boost to gain access to the
serialization capabilities.
Here is the source code I'm trying to compile to test
the install. Its the serialization equivalent of a
"hello world" app.:

////////////////////////////////////////////////
#include <iostream>
#include <fstream>
#include <boost/archive/text_oarchive.hpp>

using std::cout;
using std::endl;

class DataHold {
private:
        friend class boost::serialization::access;
        template <class Archive>
        void serialize(Archive & ar, const unsigned
int version)
        {
                ar & data1;
                ar & data2;
        }

        int data1;
        int data2;
public:
        DataHold(){}
        DataHold(int d1, int d2):data1(d1),data2(d2){}
        void dump() {
                cout << data1 << ":" << data2 << endl;
        }
};

int main()
{
        DataHold dt1(7,9);
        std::ofstream ofs("holddata.dh");
        boost::archive::text_oarchive oa(ofs);
        oa << dt1;
        ofs.close();
}
////////////////////////////////////////////

When I try to compile I get this:

In file included from
/usr/local/include/boost/config.hpp:35,
                 from
/usr/local/include/boost/archive/text_oarchive.hpp:22,
                 from boostTest.cpp:3:
/usr/local/include/boost/config/compiler/gcc.hpp:92:7:
warning: #warning "Unknown compiler version - please
run the configure tests and report the results"
/tmp/cct6F2I3.o(.gnu.linkonce.r._ZTIN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEEE[typeinfo
for
boost::archive::detail::common_oarchive<boost::archive::text_oarchive>]+0x10):
undefined reference to `typeinfo for
boost::archive::detail::basic_oarchive'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost13serialization6detail27extended_type_info_typeid_0C2Ev[boost::serialization::detail::extended_type_info_typeid_0::extended_type_info_typeid_0()]+0x7):
In function
`boost::serialization::detail::extended_type_info_typeid_0::extended_type_info_typeid_0()':
boostTest.cpp: undefined reference to
`boost::serialization::detail::extended_type_info_typeid_0::type_info_key'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEED2Ev[boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()]+0x18):
In function
`boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()':
boostTest.cpp: undefined reference to
`boost::archive::detail::basic_oarchive::~basic_oarchive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEED0Ev[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()]+0x45):
In function
`boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()':
boostTest.cpp: undefined reference to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> > >::~basic_text_oprimitive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEED0Ev[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()]+0x77):boostTest.cpp:
undefined reference to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> > >::~basic_text_oprimitive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEED1Ev[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()]+0x45):
In function
`boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()':
boostTest.cpp: undefined reference to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> > >::~basic_text_oprimitive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEED1Ev[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()]+0x77):boostTest.cpp:
undefined reference to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> > >::~basic_text_oprimitive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEED2Ev[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()]+0x45):
In function
`boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()':
boostTest.cpp: undefined reference to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> > >::~basic_text_oprimitive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEED2Ev[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()]+0x77):boostTest.cpp:
more undefined references to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> > >::~basic_text_oprimitive()'
follow
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEED1Ev[boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()]+0x18):
In function
`boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()':
boostTest.cpp: undefined reference to
`boost::archive::detail::basic_oarchive::~basic_oarchive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEED0Ev[boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()]+0x18):
In function
`boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()':
boostTest.cpp: undefined reference to
`boost::archive::detail::basic_oarchive::~basic_oarchive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEEC2Ev[boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::common_oarchive()]+0xe):
In function
`boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::common_oarchive()':
boostTest.cpp: undefined reference to
`boost::archive::detail::basic_oarchive::basic_oarchive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive11save_access14save_primitiveINS0_13text_oarchiveESsEEvRT_RKT0_[void
boost::archive::save_access::save_primitive<boost::archive::text_oarchive,
std::basic_string<char, std::char_traits<char>,
std::allocator<char> >
>(boost::archive::text_oarchive&,
std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)]+0x20): In function
`void
boost::archive::save_access::save_primitive<boost::archive::text_oarchive,
std::basic_string<char, std::char_traits<char>,
std::allocator<char> >
>(boost::archive::text_oarchive&,
std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)':
boostTest.cpp: undefined reference to
`boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
const&)'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost13serialization25extended_type_info_typeidIK8DataHoldEC1Ev[boost::serialization::extended_type_info_typeid<DataHold
const>::extended_type_info_typeid()]+0x28): In
function
`boost::serialization::extended_type_info_typeid<DataHold
const>::extended_type_info_typeid()':
boostTest.cpp: undefined reference to
`boost::serialization::extended_type_info::self_register()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive6detail21save_non_pointer_typeINS0_13text_oarchiveE8DataHoldE4save7invokexERS3_RKS4_[boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive,
DataHold>::save::invokex(boost::archive::text_oarchive&,
DataHold const&)]+0x17): In function
`boost::archive::detail::save_non_pointer_type<boost::archive::text_oarchive,
DataHold>::save::invokex(boost::archive::text_oarchive&,
DataHold const&)':
boostTest.cpp: undefined reference to
`boost::archive::detail::basic_oarchive::save_object(void
const*, boost::archive::detail::basic_oserializer
const&)'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEE4initEv[boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::init()]+0x18):
In function
`boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::init()':
boostTest.cpp: undefined reference to
`boost::archive::ARCHIVE_SIGNATURE'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEE4initEv[boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::init()]+0x98):boostTest.cpp:
undefined reference to
`boost::archive::ARCHIVE_VERSION'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEEC2ERSoj[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::basic_ostream<char,
std::char_traits<char> >&, unsigned int)]+0x21): In
function
`boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::basic_ostream<char,
std::char_traits<char> >&, unsigned int)':
boostTest.cpp: undefined reference to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> >
>::basic_text_oprimitive(std::basic_ostream<char,
std::char_traits<char> >&, bool)'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive18text_oarchive_implINS0_13text_oarchiveEEC2ERSoj[boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::basic_ostream<char,
std::char_traits<char> >&, unsigned
int)]+0x8c):boostTest.cpp: undefined reference to
`boost::archive::basic_text_oprimitive<std::basic_ostream<char,
std::char_traits<char> > >::~basic_text_oprimitive()'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost7archive19basic_text_oarchiveINS0_13text_oarchiveEE13save_overrideERKNS0_15class_name_typeEi[boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::save_override(boost::archive::class_name_type
const&, int)]+0x54): In function
`boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::save_override(boost::archive::class_name_type
const&, int)':
boostTest.cpp: undefined reference to
`boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
const&)'
/tmp/cct6F2I3.o(.gnu.linkonce.t._ZN5boost15smart_cast_impl9referenceIRNS_7archive13text_oarchiveEE11polymorphic5cross4castINS2_6detail14basic_oarchiveEEES4_RT_[boost::archive::text_oarchive&
boost::smart_cast_impl::reference<boost::archive::text_oarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_oarchive>(boost::archive::detail::basic_oarchive&)]+0xe):
In function `boost::archive::text_oarchive&
boost::smart_cast_impl::reference<boost::archive::text_oarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_oarchive>(boost::archive::detail::basic_oarchive&)':
boostTest.cpp: undefined reference to `typeinfo for
boost::archive::detail::basic_oarchive'
collect2: ld returned 1 exit status

Now, I've tried compiling some of the sample code that
comes with the boost package ... some compiles just
fine, some does not and gives me similar errors to
what I show above. I have no idea what these errors
mean nor do I understand how to make them go away.

My platform info:
  i386-redhat-linux
  gcc version 4.0.0 20050423 (Red Hat 4.0.0-2)

To install I did:
1) DL'ed and untarred boost_1_32_0.tar.bz2
2) installed the .rpm'ed boost-jam-3.1.10-i386.rpm
3) chdir boost_1_32_0
4) bjam "-sTOOLS=gcc" install

Here I got a bunch of "unknown compiler" messages but
the install seemed to go ok other than that. I checked
/usr/local/include/boost-32/boost and found all of the
.hpp files and subdirs including 'serialization'.
I also checked /usr/local/lib and found all of the .so
and .a files (The wserialization and serialization .so
files were notably absent)
I searched all over for the .so files but could not
locate them anywhere in my filesystem. I suspect this
is the main snag I'm confronting.

5) ln -s /usr/local/include/boost-32/boost
/usr/local/include/boost
6) added /usr/local/lib to /etc/ld.so.conf
7) ldconfig

Then I tried to compile the source I presented
earlier. Any help resolving the resulting errors would
be greatly appreciated.

Thanks,
Mike

                
____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.
http://auctions.yahoo.com/


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