I have some proto definitions that i want to compile to C++ headers/code. When i do, all the data types are MessageLite
, which I understand is more light weight for resource constraint devices.
However, MessageLite
is missing a bunch of functions that i need (eg: MessageToJsonString
and SerializeToOsStream
). Is there a way for protoc
to generate Message
instead of MessageLite
?
Alternatively, is there a better way to work with MessageLite
? Namely, debugging and serializing to file?
Look in your protobuf definition for the following line:
option optimize_for = LITE_RUNTIME;
and either comment it out, or remove it. That line is instructing protoc to use MessageLite, not Message.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.