Boost logo

Boost Users :

From: Number Cruncher (number.cruncher_at_[hidden])
Date: 2008-03-04 04:39:33


I'm trying to send polymorphic objects using boost::mpi, but I'm getting
extensive "undefined reference" errors for the simple test case below.

If I #include <boost/archive/text_oarchive.hpp> instead of the
mpi/communicator, everything compiles fine.

Any help greatly appreciated,
Simon

#include <boost/mpi/communicator.hpp>
#include <boost/serialization/export.hpp>

struct Base {
  virtual ~Base() {}
  virtual int id() const { return 1; }

  template<class Archive>
  void serialize(Archive &ar, const unsigned int) {
    ar & data;
  }

  int data;
};

struct Derived : public Base {
  virtual int id() const { return 2; }
};

BOOST_CLASS_EXPORT(Base)
BOOST_CLASS_EXPORT(Derived)

int
main(int argc, char *argv[])
{
  Base *b = new Base;
  Base *d = new Derived;
  delete b;
  delete d;
  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