[protobuf] comiler error from generated .proto file

2011-07-08 Thread Lars Schouw
I am getteing an error 
error CS1001: Identifier expected
when I generate a .cs file from this .proto file. How can I fix this and 
make it compile?

person.proto
message Person { 
required int32 id = 1; 
optional string name = 2;
optional string motto = 3 [default=When the cat is away, the mouse is 
alone!];
enum Gender{ 
MALE = 1;
FEMALE =2;
}
optional Gender gender = 4;
}
  
using protogen.exe -i:person.proto -o:person.cs

this generates a c# source file that has compilation errors:

private Person.Gender _gender = *Person.Gender.;*
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@gender, 
DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(Person.Gender.)]
public Person.Gender gender
{
  get { return _gender; }
  set { _gender = value; }
}

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/GM5gmkno2l8J.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] comiler error from generated .proto file

2011-07-08 Thread Jason Hsueh
You'll have to check with the developer of the C# implementation for
support, but it appears that this code is the initialization of the member
to the default value. My guess is the implementation's code generator looks
up the enum name of the default value, and assumes that the default value is
zero if none is specified. Since you don't have an enum value with numeric
value zero defined, it returns an empty symbol. Try explicitly adding a
default value?

On Fri, Jul 8, 2011 at 6:29 AM, Lars Schouw sch...@gmail.com wrote:

 I am getteing an error
 error CS1001: Identifier expected
 when I generate a .cs file from this .proto file. How can I fix this and
 make it compile?

 person.proto
 message Person {
  required int32 id = 1;
 optional string name = 2;
  optional string motto = 3 [default=When the cat is away, the mouse is
 alone!];
 enum Gender{
  MALE = 1;
 FEMALE =2;
  }
 optional Gender gender = 4;
 }

 using protogen.exe -i:person.proto -o:person.cs

 this generates a c# source file that has compilation errors:

 private Person.Gender _gender = *Person.Gender.;*
 [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@gender,
 DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
 [global::System.ComponentModel.DefaultValue(Person.Gender.)]
 public Person.Gender gender
 {
   get { return _gender; }
   set { _gender = value; }
 }

 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/protobuf/-/GM5gmkno2l8J.
 To post to this group, send email to protobuf@googlegroups.com.
 To unsubscribe from this group, send email to
 protobuf+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.