Formatting your code properly and posting it within forum bbcode code tags as Zeus_ suggested is really important. It looks like your code attracted the attention of the forum software that does things like replace a colon followed by a "p" with an emoji, then you tried removing the emoji and left your code in a mangled state:
Code:
msgpack: pack(buffer, obj1);// this line is throwing the error
The "msgpack" followed by a colon is what we call a label, typically used with goto, but since we rarely use goto in C++, this rarely gets used. Consequently, I would expect an error message telling you that the name "pack" is unknown, or something along those lines, but we get a different error message, so I'm guessing that you did in fact originally write:
Code:
msgpack::pack(buffer, obj1);
Looking at the README for msgpack for C++, this appears to be correct.
Originally Posted by
Shiv94
doesn't the message pack library support array of struct?..should i use a vector here instead?
You're talking about a custom library, not part of the standard library. It is possible that some people here have used it and might know the answer to this immediately, but for the rest of us, we have to do the same thing that you should have done: read the documentation and write test code to check for ourselves.
I would start by using an int, then an array of int, then a vector int. After I'm confident that I can use msgpack's pack with these three, I would go on to use a struct object of my own: it's possible that you might encounter an error at this point, in which case you'll have to check the msgpack docs on how to fix it. If you don't get an error at this point, then try with an array of the same struct objects, and then a vector of the same struct objects.