Boost logo

Boost Users :

Subject: [Boost-users] Flood of messages when building with boost_serialization
From: Tony Camuso (tcamuso_at_[hidden])
Date: 2015-03-04 20:59:19


Using Fedora 21 64 bit
gcc 4.9.2
Qt Creator 3.2.1
Qt 5.3.2

When I run make from the command line, all is well.

$ g++ -Wall -c kabi-serial.cpp -lboost_serialization

### no errors ###

Even if I build the whole project from the command line, there are no errors.

$ g++ -Wall -o kabi-parser -x c kabi.c -x c checksum.c -x c++ kabi-node.cpp -x c++ kabi-serial.cpp -lboost_serialization -lsparse

However, when I build it from Qt, I get the following compiler output.
I understand the "unused parameter" message, as I'm not using versioning
in my serialization implementation.

I haven't tried executing the serialization code, yet, but I wonder if it
will even execute properly, given the nature of the messages. The rest of
the code executes fine.

The serialization code is very simple and follows the messages.

20:38:17: Starting: "/usr/bin/make" kabi-serial.o
g++ -c -pipe -g -Wall -W -fPIE -I/home/tcamuso/Qt5.3.2/5.3/gcc_64/mkspecs/linux-g++ -I../../kabi -I../src/sparse -I../src/sparse -I. -o kabi-serial.o ../src/kabi-serial.cpp
In file included from ../src/kabi-serial.cpp:14:0:
../src/kabi-serial.h: In instantiation of 'void Cqnodelist::serialize(Archive&, unsigned int) [with Archive = boost::archive::text_oarchive]':
/usr/include/boost/serialization/access.hpp:118:9: required from 'static void boost::serialization::access::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive; T = Cqnodelist]'
/usr/include/boost/serialization/serialization.hpp:69:69: required from 'void boost::serialization::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive; T = Cqnodelist]'
/usr/include/boost/serialization/serialization.hpp:128:27: required from 'void boost::serialization::serialize_adl(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive; T = Cqnodelist]'
/usr/include/boost/archive/detail/oserializer.hpp:152:5: required from 'void boost::archive::detail::oserializer<Archive, T>::save_object_data(boost::archive::detail::basic_oarchive&, const void*) const [with Archive = boost::archive::text_oarchive; T = Cqnodelist]'
/usr/include/boost/archive/detail/oserializer.hpp:101:1: required from 'class boost::archive::detail::oserializer<boost::archive::text_oarchive, Cqnodelist>'
/usr/include/boost/archive/detail/oserializer.hpp:253:13: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/boost/archive/detail/oserializer.hpp:314:44: required from 'static void boost::archive::detail::save_non_pointer_type<Archive>::invoke(Archive&, T&) [with T = Cqnodelist; Archive = boost::archive::text_oarchive]'
/usr/include/boost/archive/detail/oserializer.hpp:525:24: required from 'void boost::archive::save(Archive&, T&) [with Archive = boost::archive::text_oarchive; T = Cqnodelist]'
/usr/include/boost/archive/detail/common_oarchive.hpp:69:40: required from 'void boost::archive::detail::common_oarchive<Archive>::save_override(T&, int) [with T = Cqnodelist; Archive = boost::archive::text_oarchive]'
/usr/include/boost/archive/basic_text_oarchive.hpp:80:9: required from 'void boost::archive::basic_text_oarchive<Archive>::save_override(T&, int) [with T = Cqnodelist; Archive = boost::archive::text_oarchive]'
/usr/include/boost/archive/detail/interface_oarchive.hpp:63:9: required from 'Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = Cqnodelist; Archive = boost::archive::text_oarchive]'
../src/kabi-serial.cpp:42:9: required from here
../src/kabi-serial.h:54:50: warning: unused parameter 'version' [-Wunused-parameter]
   void serialize(Archive & ar, const unsigned int version)
                                                   ^
20:38:17: The process "/usr/bin/make" exited normally.
20:38:17: Elapsed time: 00:00.

------------- source code ----------------------

#include <boost/serialization/vector.hpp>
#include <boost/archive/text_oarchive.hpp>

using namespace std;

namespace boost {
namespace serialization {

class Cqnodelist
{
public:
        friend class boost::serialization::access;
        Cqnodelist(){}
        vector<int>qnodelist;

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

void kb_write_list ()
{
        Cqnodelist ql;

        ofstream ofs("kabi-list.dat");

        {
                boost::archive::text_oarchive oa(ofs);
                oa << ql;
        }
}

} // namespace serialization
} // namespace boost


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