3

I am trying my first protobuf program using PHP but without success

Following is the file which I created

listing.proto

syntax = "proto3";
package foo.bar;

message Listing {
    string ProgramName = 1;
    string EpisodeName = 2;
    int32 EpisodeNumber = 3;
    bool IsLive = 4;    
}

Command

E:\Exercises\PHP\src>c:\PHP\proto\bin\protoc.exe --php_out=. listing.proto

Error Message

[libprotobuf WARNING T:\src\github\protobuf\src\google\protobuf\compiler\parser.cc:651] No syntax specified for the proto file: listing.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
--php_out: Can only generate PHP code for proto3 .proto files.  Please add 'syntax = "proto3";' to the top of your .proto file.

I found similar or same errors in SO but solution mentioned in there did not work for me. Any help is highly appreciated

Sathish Kumar
  • 2,150
  • 10
  • 29
  • 51

0 Answers0