Matthew, I suspect you have a version mismatch between your protoc and
libprotobuf. For C++ the libprotobuf version has to match the version of
protoc used to generate code.

On Mon, Aug 12, 2019 at 8:11 PM Matthew Allen <[email protected]> wrote:

> Here is some example code you could play with:
>
> #include "test.pb.h"
>
> int main(int args, const char **arg)
> {
>     Message1 m1;
>     m1.set_a("22");
>     m1.set_b("33");
>     WrapperMessage wm1;
>     wm1.set_allocated_m1(&m1);
>     auto s = wm1.SerializeAsString();
>
>     WrapperMessage wm2;
>     wm2.ParseFromString(s);
>     if (wm2.has_m1())
>     {
>         auto msg1 = wm2.m1();
>         auto msg1a = msg1.a();
>         auto msg1b = msg1.b();
>     }
>
>     return 0;
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/57e7fc88-b416-42e8-bd17-b42eaa8e73cf%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/57e7fc88-b416-42e8-bd17-b42eaa8e73cf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr7jUVfO%2BCfu4adaMkTaMeSMpy4OC1XOFk0kWDA8se3znw%40mail.gmail.com.

Reply via email to