Boost logo

Boost Users :

From: Ray Hilton (RayHilton_64_at_[hidden])
Date: 2004-12-08 16:59:37


I get 17 link errors trying to compile a very simple example from the
touturial section of the documention (what im trying to compile is listed at
the end of this post verbatim).
My enviorment is all default except for an include path to boost.

Any solution?

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

class gps_position
{
private:
    friend class boost::serialization::access;
    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() {
    std::ofstream ofs("filename");
    boost::archive::text_oarchive oa(ofs);

    const gps_position g(35, 59, 24.567f);
    oa << g;
    ofs.close();

    std::ifstream ifs("filename", std::ios::binary);
    boost::archive::text_iarchive ia(ifs);

 gps_position newg;
    ia >> newg;

 ifs.close();
    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