Flood of messages when building with boost_serialization
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
AMDG On 03/04/2015 06:59 PM, Tony Camuso wrote:
<snip>
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 warning is harmless. Just comment out the parameter name to suppress it. The rest of the message is part of the same warning. It's just the template instantiation stack.
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: <snip> ../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)
In Christ, Steven Watanabe
Steven, Thank you. And even better to know that you're a brother in Christ! Blessings, Tony On 03/04/2015 09:33 PM, Steven Watanabe wrote:
AMDG
On 03/04/2015 06:59 PM, Tony Camuso wrote:
<snip>
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 warning is harmless. Just comment out the parameter name to suppress it. The rest of the message is part of the same warning. It's just the template instantiation stack.
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: <snip> ../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)
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Why is the compiler okay with ...
std::vector<int>intvec;
... but throws an error for ...
std::vector
Very simple case. I just need to know what I'm doing wrong.
#include <fstream>
#include
Tony Camuso wrote
Why is the compiler okay with ... std::vector <int> intvec; ... but throws an error for ... std::vector
pintvec;
The answer can be found here: </a> http:// http://stackoverflow.com/questions/19076299/how-do-i-serialize-a-class-conta... I concede that this should be added to the documentation. Feel free to open a trac item to remind me of this. So the solution is to wrap your int inside a class. This will give it a unique type and distinguish from all the other int instances you don't really want to track. Also you can use BOOST_SERIALIZATION to create a wrapper. -- View this message in context: http://boost.2283326.n4.nabble.com/Flood-of-messages-when-building-with-boos... Sent from the Boost - Users mailing list archive at Nabble.com.
On 03/06/2015 07:42 PM, Robert Ramey wrote:
Tony Camuso wrote
Why is the compiler okay with ... std::vector <int> intvec; ... but throws an error for ... std::vector
pintvec; The answer can be found here:
</a> http:// http://stackoverflow.com/questions/19076299/how-do-i-serialize-a-class-conta...
I concede that this should be added to the documentation. Feel free to open a trac item to remind me of this.
So the solution is to wrap your int inside a class. This will give it a unique type and distinguish from all the other int instances you don't really want to track. Also you can use BOOST_SERIALIZATION to create a wrapper.
Thanks, Robert.
Wasn't aware of the BOOST_SERIALIZATION macro. I'll look it up.
Another question. It seems that attempts to serialize containers of pointers
of any kind throw compiler errors. For example,
std::vector<string> str; // compiler is ok with serializing this
std::vector
-- View this message in context: http://boost.2283326.n4.nabble.com/Flood-of-messages-when-building-with-boos... Sent from the Boost - Users mailing list archive at Nabble.com. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Tony Camuso wrote
On 03/06/2015 07:42 PM, Robert Ramey wrote:
Tony Camuso wrote
Why is the compiler okay with ... std::vector
<int>
intvec; ... but throws an error for ... std::vector
pintvec;
The answer can be found here:
http://stackoverflow.com/questions/19076299/how-do-i-serialize-a-class-conta...
I concede that this should be added to the documentation. Feel free to open a trac item to remind me of this.
actually, I think I can do better than that. I got in the habit of adding a layer of static asserts to trap cases where the user breaks some rule or another. At the site of the trap, a comment in the code explains what on has to do to fix it. Of course this is self defense so I don't have continually answer the same questions over and over. Over the years as I get a new question, I added traps like this. For some reason this question hasn't been asked often enough to trigger my normal behavior. But I think I can more or less easily implement this.
So the solution is to wrap your int inside a class. This will give it a unique type and distinguish from all the other int instances you don't really want to track. Also you can use BOOST_SERIALIZATION to create a wrapper.
Note: it's BOOST_SERIALIZATION_STRONG_TYPEDEF. It's got it's own special section in the manual. But it only works for numeric types. If you want to serialize a string pointer you'll have to snooker your system like this:
Thanks, Robert.
Wasn't aware of the BOOST_SERIALIZATION macro. I'll look it up.
Another question. It seems that attempts to serialize containers of pointers
of any kind throw compiler errors. For example,
std::vector<string> str; // compiler is ok with serializing this
std::vector
Is my reading comprehension off? :)
No, but you might want to do more of it. -- View this message in context: http://boost.2283326.n4.nabble.com/Flood-of-messages-when-building-with-boos... Sent from the Boost - Users mailing list archive at Nabble.com.
On 03/08/2015 08:33 PM, Robert Ramey wrote:
Tony Camuso wrote
On 03/06/2015 07:42 PM, Robert Ramey wrote:
Tony Camuso wrote
Why is the compiler okay with ... std::vector
<int>
intvec; ... but throws an error for ... std::vector
pintvec;
The answer can be found here:
http://stackoverflow.com/questions/19076299/how-do-i-serialize-a-class-conta...
I concede that this should be added to the documentation. Feel free to open a trac item to remind me of this.
actually, I think I can do better than that. I got in the habit of adding a layer of static asserts to trap cases where the user breaks some rule or another. At the site of the trap, a comment in the code explains what on has to do to fix it. Of course this is self defense so I don't have continually answer the same questions over and over. Over the years as I get a new question, I added traps like this. For some reason this question hasn't been asked often enough to trigger my normal behavior. But I think I can more or less easily implement this.
You may want to post a FAQ for boost newbies. In your spare time, of course. :)
So the solution is to wrap your int inside a class. This will give it a unique type and distinguish from all the other int instances you don't really want to track. Also you can use BOOST_SERIALIZATION to create a wrapper.
Note: it's BOOST_SERIALIZATION_STRONG_TYPEDEF. It's got it's own special section in the manual.
But it only works for numeric types.
If you want to serialize a string pointer you'll have to snooker your system like this:
Thanks, Robert.
Wasn't aware of the BOOST_SERIALIZATION macro. I'll look it up.
Another question. It seems that attempts to serialize containers of pointers of any kind throw compiler errors. For example,
std::vector<string> str; // compiler is ok with serializing this
std::vector
pstr; // compiler throws an error The documentation gave me the impression that the serialization lib would dereference the pointers correctly, and perform all the housekeeping around that. Also got the impression that nothing special had to be done for the deserialize step.
That's not correct - this problem occurs for all "primitive types". Look at the documentation on "serialization level". This basically means all C++ primitive types + std::string. To handle std::string use:
Is my reading comprehension off? :)
No, but you might want to do more of it.
I have it working, now. I was confusing containers of pointers with pointers to containers. The latter is supported, the former isn't, for reasons that become obvious when you look at memory with a debugger. Thanks for your help. Regards, Tony
participants (3)
-
Robert Ramey
-
Steven Watanabe
-
Tony Camuso