It occurred to me that protoc shouldn't accept your file either. Did it really compile successfully? What do you actually get in your FileDescriptorSet?
On Wednesday, September 22, 2010, Jason Hsueh <[email protected]> wrote: > 1) I would guess the problem is that the "action" message type refers to > undefined types eaction_type and ereason. There are probably error messages > farther up indicating that action could not be built. Because action isn't a > valid type, RecordHeader can't refer to it, and thinks that action is an > undefined_symbol as well. The DescriptorBuilder will read in all inputs, and > cross-link the types once everything has been processed. It doesn't matter > what order they are defined in. > 2) You can manually build the FileDescriptorProto representation yourself, or > use the classes used by the compiler: see google::protobuf::compiler::Parser > or google::protobuf::compiler::Importer. > > On Wed, Sep 22, 2010 at 4:42 AM, Himanshu Srivastava <[email protected]> > wrote: > > Hi Kenton, > I have the following message in my .proto file: > //************************************************/ > package traceFileMessagesProto; > message RecordHeader { > message myqueue{ > optional uint32 id = 1; > optional uint32 Priority = 2; > } > > message action{ > optional eactiontype eactiontype_instance = 1; > optional ereason ereason_instance = 2; > optional myqueue myqueue_instance = 3; > } > optional action action_instance =1; > } //end RecordHeader > /***************************************************/ > Thus, "action" is nested message in "RecordHeader" and has "queue" submessage > in it. > I used the protoc compiler -o <desc-file> option to generate the descriptor > set file and loaded it through istream in c++ application, followed by > streaming FileDescriptorSet object with this descriptor set file: > > > //***************************************************************// > ifstream desc_file("mydescriptor.dsc",ios::in); > FileDescriptorSet f; > f.ParseFromIstream(&desc_file); > //***************************************************************// > > > However, while parsing through DescriptorPool::BuildFile(f.file(0)); > at the line corresponding to the message file line: > => optional action action_instance =1; > the BuildFile() function exits by giving error: > undefined_symbol "action" > The code returns through the following function in protoc library: > //***************************************************************// > void DescriptorBuilder::AddNotDefinedError( > const string& element_name, > const Message& descriptor, > DescriptorPool::ErrorCollector::ErrorLocation location, > const string& undefined_symbol) { > if (possible_undeclared_dependency_ == NULL) { > AddError(element_name, descriptor, location, > "\"" + undefined_symbol + "\" is not defined."); > //***************************************************************// > The only possible explanation could be that the message "action" is not > parsed before its instance declaration from my .proto/descriptor_set file. > Probably all nested messages should be parsed on their instance declarations > in a recursive manner in the DescriptorPool::Buildfile() function. > > > Qustion1: > How do I solve the above issue? > Question 2: > Can not I simply load my messages in DescriptorPool through the .proto file > instead of calling the service of protoc compiler to generate a descriptor > file? I have to generate .proto file at runtime and I don't want to call > another exe (protoc.exe) from my application for dependency reasons. > > > Thanks in advance for any solutions /directions. > Regards, > Himanshu > > > > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
