Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2005-06-01 15:15:31


Yan,

    oa << BOOST_SERIALIZATION_NVP(*bs0);

Certainly looks suspicious to me, although I'm not familiar with what's in the examples. In addition to Robert's rtti suggestion try using a text_archive and drop the NVP macro usage. My guess is the '*bs0' is not proper in this context.

Jeff Flinn
  "Yan Zhang" <Yan.Zhang_at_[hidden]> wrote in message news:F96935FCB9C3D549B3B6CD8915811A2F0F746544_at_mail60nt.mitchell.com...
  Hi Jeff,

   

  I installed Boost 1.32 on my computer (Windows Server 2003 and Visual Studio .NET 2003). A directory: \boost_1_32_0 was created. In \boost_1_32_0\libs\serialization\vc7ide, I found the projects for building serialization library and test examples. I can build the library (libboost_serialization.lib) and examples, and they run well. All examples are Windows console applications.

   

  Then I created an MFC application, linked it with the library. In Document class, I did a test similar to the one presented in demo_xml.cpp and demo_xml.hpp:

   

  .

   

  #include "stdafx.h"

  #include "MFCTests.h"

  #include "MFCTestsDoc.h"

  #include <iostream>

  #include <sstream>

  #include <string>

  #include <boost/archive/tmpdir.hpp>

  #include <boost/archive/xml_oarchive.hpp>

   

  #include "demo_xml.hpp"

   

  ..

   

  void CMFCTestsDoc::OnTestSerialize()

  {

      bus_stop *bs0 = new bus_stop_corner(

          gps_position(34, 135, 52.560f),

          gps_position(134, 22, 78.30f),

          "24th Street", "10th Avenue"

      );

   

      std::string filename(boost::archive::tmpdir());

      filename += "/demo.xml";

   

      std::ofstream ofs(filename.c_str());

      assert(ofs.good());

      boost::archive::xml_oarchive oa(ofs);

      oa << BOOST_SERIALIZATION_NVP(*bs0);

   

          .

  }

   

  Execution fails in last statement with message:

   

  Unhandled exception at 0x77e55dea in MFCTests.exe: Microsoft C++ exception: __non_rtti_object @ 0x0012e800.

   

  The build was debug build, application and library were build with runtime library option "Multi-threaded Debug (/MTd)". I tried to use different options such as "Multi-threaded Debug DLL (/MDd)", it failed the same way.

   

  In MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/boostvc.asp), it discussed Boost for Visual Studio C++. It stated that Boost works well with VC++ 7.1. Of course we know it doesn't work well with previous VC++ such as VC++ 6.0 which I tried and failed badly.

   

  Thanks,

   

  Yan

   

------------------------------------------------------------------------------

  From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Jeff Flinn
  Sent: Wednesday, June 01, 2005 9:00 AM
  To: boost-users_at_[hidden]
  Subject: [Boost-users] Re: boost.serialization 1.32 example execution failsinMFC project (Visual Studio .NET 2003)

   

  Yan,

   

  I extensively use boost 1.32 serialization in MFC projects with no problems. You'll need to provide more info on your problem: some code, exact error messages, etc.

   

  So is Boost really mentioned in MSDN?

   

  Jeff Flinn

   

  PS. Please restrict your postings to plain text. Other wise it's difficult to avoid top posting.

    "Yan Zhang" <Yan.Zhang_at_[hidden]> wrote in message news:F96935FCB9C3D549B3B6CD8915811A2F0F746300_at_mail60nt.mitchell.com...

    I installed Boost 1.32 in Windows with Visual Studio .NET 2003. I tested serialization provided in "vc7ide" project, it runs successfully. Of course, all test projects are "Console", no MFC library involved. Then I used the same library in MFC project, the execution failed in function:

     

    BOOST_SERIALIZATION_NVP(s)

     

    From MSDN, it was said that Boost is supported in Visual Studio .NET 2003. I labored a week to upgrade our MFC project to Visual Studio .NET 2003 and it still has problem. Any idea? Thanks in advance.

     

     

    Yan

----------------------------------------------------------------------------

    _______________________________________________
    Boost-users mailing list
    Boost-users_at_[hidden]
    http://lists.boost.org/mailman/listinfo.cgi/boost-users

------------------------------------------------------------------------------

  _______________________________________________
  Boost-users mailing list
  Boost-users_at_[hidden]
  http://lists.boost.org/mailman/listinfo.cgi/boost-users



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