Boost logo

Boost Users :

From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2005-12-22 22:13:59


I thought I had this working once after I found I needed the NVP wrappers
for XML archives. Now the problem is back. Below is a highly simplified
version of the problem followed by the compiler error output. I can't make
heads or tails of the error messages.

Anyone have any ideas?

Merrill

Succ.h=======================
#include "boost/serialization/nvp.hpp"
#include "boost/test/test_tools.hpp"

namespace MyNS {
class Succ {
        friend class Succ_Test;
private:
        size_t mInputIndex;
        bool mIsInbound;

    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive& ar, const unsigned int version) {
        ar & BOOST_SERIALIZATION_NVP(mInputIndex);
        ar & BOOST_SERIALIZATION_NVP(mIsInbound);
    }//serialize()

public:
        Succ() {} // needed by serialization
        Succ(size_t inputIndex, bool isInbound);
        virtual ~Succ();
        size_t inputIndex() const;
        bool isInbound() const;
};//Succ
}//MyNS

Succ.cc=====================================
#include "Succ.h"

namespace MyNS {
Succ::Succ(size_t inputIndex, bool isInbound):
                   mInputIndex(inputIndex), mIsInbound(isInbound) {}
Succ::~Succ() {}
size_t Succ::inputIndex() const { return mInputIndex; }
bool Succ::isInbound() const { return mIsInbound; }
}//MyNS

Succ_Test.cc=================================
#include <fstream>
#include "Succ.h"

#include "boost/archive/xml_iarchive.hpp"
#include "boost/archive/xml_oarchive.hpp"
#include "boost/test/test_tools.hpp"

using namespace std;

namespace MyNS {

class Succ_Test {
public:
    void run();
};//Succ_Test
//=============================================================================

void Succ_Test::run() {
        const char* archiveFile = "temp/Succ_archive.xml";
        size_t inputIndex = 65;
        bool isInbound = true;

        Succ* testObj_out = new Succ(inputIndex, isInbound);
    {
                // save data to archive
                ofstream outStream(archiveFile);
                boost::archive::xml_oarchive outArchive(outStream);

                // write class instance to archive
        outArchive << testObj_out;
        } // archive and stream closed when destructors are called

        Succ* testObj_in = new Succ();
        {
                // create and open an archive for input
        ifstream inStream(archiveFile);
        boost::archive::xml_iarchive inArchive(inStream);
 
                // read class state from archive
        inArchive >> testObj_in;
        } // archive and stream closed when destructors are called
        return;
}//run()
}//MyNS

compile stderr======================================
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/basic_xml_oarchive.hpp: In member function `void boost::archive::basic_xml_oarchive<Archive>::save_override(T&, int) [with T = MyNS::Succ*, Archive = boost::archive::xml_oarchive]':
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/detail/interface_oarchive.hpp:78: instantiated from `Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = MyNS::Succ*, Archive = boost::archive::xml_oarchive]'
E:/Dev-Cpp/Workflow/test/src/Succ_Test.cc:48: instantiated from here
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/basic_xml_oarchive.hpp:86: error: incomplete type `boost::STATIC_ASSERTION_FAILURE< false>' used in nested name specifier
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/basic_xml_oarchive.hpp:86: error: size of array has non-integral type `<type error>'
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/basic_xml_iarchive.hpp: In member function `void boost::archive::basic_xml_iarchive<Archive>::load_override(T&, int) [with T = MyNS::Succ*, Archive = boost::archive::xml_iarchive]':
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/xml_iarchive.hpp:74: instantiated from `void boost::archive::xml_iarchive_impl<Archive>::load_override(T&, int) [with T = MyNS::Succ*, Archive = boost::archive::xml_iarchive]'
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/detail/interface_iarchive.hpp:76: instantiated from `Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = MyNS::Succ*, Archive = boost::archive::xml_iarchive]'
E:/Dev-Cpp/Workflow/test/src/Succ_Test.cc:58: instantiated from here
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/basic_xml_iarchive.hpp:66: error: incomplete type `boost::STATIC_ASSERTION_FAILURE< false>' used in nested name specifier
E:/Dev-Cpp/Workflow/boost-1_33_1/include/boost/archive/basic_xml_iarchive.hpp:66: error: size of array has non-integral type `<type error>'
make: *** [test/obj/Succ_Test.o] Error 1
//===========================================


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