Boost logo

Boost Users :

From: rwm33_at_[hidden]
Date: 2006-02-14 15:30:31


Hello

When updating libraries from boost 1.32 to 1.33 our previous code that had no previous linking problems developed linking errors. I then attempted to compile the demo.cpp serialization code included in the boost documentation tutorial and received the same errors.

I attach below the code and the error message I got.

I am working on a Linux Gentoo machine with Boost installed by e-portage. I believe boost is properly installed as it works with other libraries.
 
Any suggestion?

Thanks
Ryan McKeown
Drexel University
Physics Dept.

==========================================
CODE
#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", std::ios::binary);
        boost::archive::text_iarchive ia(ifs);
        // read class state from archive
        ia >> newg;
        // archive and stream closed when destructors are called
    }
    return 0;
}

======================================

ERROR

/tmp/cchtRupV.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEE4initEv+0x1a): In function `boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::init()':
: undefined reference to `boost::archive::ARCHIVE_SIGNATURE'
/tmp/cchtRupV.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEE4initEv+0x84): In function `boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::init()':
: undefined reference to `boost::archive::ARCHIVE_VERSION'
/tmp/cchtRupV.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_iarchiveINS0_13text_iarchiveEE4initEv+0x2f): In function `boost::archive::detail::common_iarchive<boost::archive::text_iarchive>::init()':
: undefined reference to `boost::archive::ARCHIVE_SIGNATURE'
/tmp/cchtRupV.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_iarchiveINS0_13text_iarchiveEE4initEv+0xd0): In function `boost::archive::detail::common_iarchive<boost::archive::text_iarchive>::init()':
: undefined reference to `boost::archive::ARCHIVE_VERSION'
/tmp/cchtRupV.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEEC2Ev+0xe): In function `boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::common_oarchive()':
: undefined reference to `boost::archive::detail::basic_oarchive::basic_oarchive()'
/tmp/cchtRupV.o(.gnu.linkonce.t._ZN5boost7archive6detail15common_iarchiveINS0_13text_iarchiveEEC2Ev+0xe): In function `boost::archive::detail::common_iarchive<boost::archive::text_iarchive>::common_iarchive()':
: undefined reference to `boost::archive::detail::basic_iarchive::basic_iarchive()'
/tmp/cchtRupV.o(.gnu.linkonce.t._ZN5boost13serialization6detail27extended_type_info_typeid_0C2Ev+0x7): In function `boost::serialization::detail::extended_type_info_typeid_0::extended_type_info_typeid_0()':
: undefined reference to `boost::serialization::detail::extended_type_info_typeid_0::type_info_key'
collect2: ld returned 1 exit status


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