Hello, Feng Xiao, 

I followed you advice, and got through with the protoc, thanks. 

yet there emerged new problems as I proceeded. 

I had configured to export all the protocol buffer generated results into a 
Java package in the Eclipse (see the screenshot)

<https://lh3.googleusercontent.com/-90shhXVVf68/VnoKTrAS1RI/AAAAAAAAAF4/vISlru05Zik/s1600/extra-inner-class-exposed.png>

 I noticed some problems here:

1: there are three items instead of one; 
according to previous experience, there should be only one file with the 
java_outer_classname, which is  "GubMessage" in this context; yet you can 
see that the inner class, (the "GMessage" in this case) is also presented 
under the package on the same hierarchy with "GubMessage", you can see that 
two java files "GMessage.java", "GMessageOrBuilder" are now presented in 
parallel with "GubMessage.java". is this a problem or intended result?

2, you might also notice that there were some errors existed in the java 
files. I checked one of them (see screenshot),  when I changed to 
"com.gubnoi.protocol.MessageHeaders.Header", the error disappeared.  it 
seems to me that protoc had not handled the outer class properly while 
importing types

<https://lh3.googleusercontent.com/-KD_6dAGCJAs/VnoNrVwgYYI/AAAAAAAAAGE/t8MDkJhi19s/s1600/the-error.png>



Cheers


On Tuesday, December 22, 2015 at 1:18:09 PM UTC+8, George Wang wrote:
>
>
> Hello, 
>
> I am using the released java package of protobuf-3.0.0-beta-1 
> (*protobuf-java-3.0.0-beta-1.zip 
> <https://github.com/google/protobuf/releases/download/v3.0.0-beta-1/protobuf-java-3.0.0-beta-1.zip>),
>  *
>
> I have problem of having protoc to import and recognize a type: 
>
> I have two proto files ("gubmessage.proto","messageheaders.proto") in the 
> source directory (see below)
>
>
> <https://lh3.googleusercontent.com/-gJDR8JSrLi0/VnjQvo7ajlI/AAAAAAAAAFc/rnS5vN5mI4I/s1600/sourcedirectory.png>
>
> the "gubmessage.proto" import the"messageheaders.proto"; and also import 
> the "any.proto" under protobuf-3.0.0-beta-1/src/google/protobuf (see below) 
> ----------------------------------------
> syntax = "proto3";
>
> import "messageheaders.proto";
> import "google/protobuf/any.proto";
>
> package gubmessage;
>
> option java_generate_equals_and_hash = true;
> option java_multiple_files = true;
> option java_package = "com.gubnoi.protocol";
> option java_outer_classname = "GubMessage";
>
> message GMessage{
>   Headers headers = 1;  
>   Any body  = 2 ;   
> }
> -------------------------------------------
>  the messageheaders.proto 
> ------------------------------------------
> syntax = "proto3";
>
> package messageheaders;
> option java_package = "com.gubnoi.protocol";
> option java_outer_classname = "MessageHeaders";
>
> message Headers{
>  
>         bool censured = 1;
>         string header = 2;
> repeated string tag = 3 ;
> }
> -------------------------------------
>
> then I run the command " protoc --proto_path=$FR 
> --proto_path=./google/protobuf --java_out=$TO $FR/gubmessage.proto", 
>
> the environment FR refers to the source directory, and the TO refers to 
> the destination directory
>
> the protoc replied that the imported types "Headers" and "Any" are not 
> defined. in the mean time, there are also two warnings say that the imports 
> are not used (see below) 
>
>
> <https://lh3.googleusercontent.com/-UNoa5FGabIo/VnjVPQAIAXI/AAAAAAAAAFo/VWh822M9kSM/s1600/protocresults.png>
>
>
> any advice?
>
> thanks 
>

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to