• Advertisement
Sign in to follow this  

Problems with boost::serialization

This topic is 4858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I downloaded boost 1.32.0 today and built everything (I think). When I tried one of the samples from the serialization docs it didn't work very well.
#include <fstream>
#include <boost/archive/text_oarchive.hpp>

// had to add this, without I got loads of linker errors
// don't know if this is the right lib to link, there are quite many of them
#pragma comment(lib, "libboost_serialization-vc71-sgd-1_32.lib")

class gps_position
    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;
    gps_position(int d, int m, float s) :
        degrees(d), minutes(m), seconds(s)

int main()
    std::ofstream file("hmm");
    boost::archive::text_oarchive oa(file);
    gps_position g(35, 59, 24.567f);
    oa << g;
This crashes with a debug error. It's the last line that causes the crash.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement