3

I am developing an application that must be cross compiled for a target that uses google protocol buffers version 3.0.0. Is there any way to specify in the protoc command (or .proto files) that generated code should be compatible with protocol buffers version 3.0.0, even if the protoc I use to generate the code is a later version (such as 3.5.1)?

Updating the target is not an option, and I don't mind installing 3.0.0 in my development environment, but it seems a bit heavy handed to say that anyone who wants to build this code must install a specific version of protocol buffers.

Mike Godin
  • 3,727
  • 3
  • 27
  • 29

1 Answers1

-2

On top of your proto descriptor you can specify that you are using proto3:

syntax = "proto3";

You have an example there: https://developers.google.com/protocol-buffers/docs/reference/proto3-spec

Luc
  • 1,393
  • 1
  • 6
  • 14
  • 1
    Unfortunately, that does not specify the version of protoc in the output file, so you still can't use the generated file with a different version of protocol buffers. – Mike Godin May 01 '18 at 13:35