Re: Import broken?
Thanks!! I also noticed that I get a permission denied error if I specify either a valid path or . for the --proto_path argument on the command line. What I did to get it to work was to cd to the directory the file is in, and then simply pass the file name to --cpp_out without passing a --proto_path argument. The resulting code is now compiles :) Below is how got .proto files compiling with protoc as a custom build step in VS: protobuild.cmd [inputs] protobuild.cmd is the following: @echo off cd %~p1 protoc.exe --cpp_out= %~n1%~x1 The reason for the .cmd file is that the [inputs] macro from VS provides the .proto file to the command line using a relative path. The cmd file takes the relative path and expands it out to a fully qualified path, filename and extension and passes it to protoc. On Oct 9, 5:00 pm, Kenton Varda [EMAIL PROTECTED] wrote: On Thu, Oct 9, 2008 at 12:52 PM, [EMAIL PROTECTED] wrote: protoc.exe --cpp_out= [Fully qualified path name] Ah, ok, you've identified a bug. protoc is supposed to reject any input file which is not located within the import path. The import path is specified using --proto_path and defaults to the current directory. The problem is that protoc detects whether an input file's path is absolute based on whether it starts with a slash, but on Windows absolute paths don't start with a slash. So, protoc failed to report the incorrect input path. To fix this, you can either do: protoc --proto_path=[full path of current directory] --cpp_out=. [full path of input file] Or do: protoc --cpp_out=. [file name without path] I'll make sure the bug gets fixed. Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Import broken?
protobuf_BuildDesc_RequestHeader_2eproto() should be declared in RequestHeader.pb.h. Is it not? What exact flags are you passing to protoc? On Thu, Oct 9, 2008 at 8:29 AM, [EMAIL PROTECTED] wrote: I'm in the process of evaluating PB for a distributed cross language project I'm on. I've created a little 'hello world' app to test it's capabilities. I have created 2 simple .proto files, RequestHeader.proto and Rerender.proto. They compile and run as expected. However, if I import RequestHeader into Rerender with the following line: import RequestHeader.proto; I get the following compile error: Error C2039: 'protobuf_BuildDesc_RequestHeader_2eproto' : is not a member of '`global namespace'' The method protobuf_BuildDesc_RequestHeader_2eproto() doesn't exist anywhere in the code except where it errors out. Below is the offending method in Rerender.pb.cc that contains the error: void protobuf_BuildDesc_e_3a_2fVital_203_2e0_2fCPPProtobufTest_2fCPPProtobufTest_2fRerender_2eproto() { static bool already_here = false; if (already_here) return; already_here = true; GOOGLE_PROTOBUF_VERIFY_VERSION; ::google::protobuf::DescriptorPool* pool = ::google::protobuf::DescriptorPool::internal_generated_pool(); ::protobuf_BuildDesc_RequestHeader_2eproto(); // -- ERROR pool-InternalBuildGeneratedFile( \n;e:/Vital 3.0/CPPProtobufTest/CPPProtob ufTest/Rerender.proto\032\023RequestHeader.pro to\\030\n\010Rerender\022\014\n\004Data\030\001 \002(\t, 108, protobuf_BuildDesc_e_3a_2fVital_203_2e0_2fCPPProtobufTest_2fCPPProtobufTest_2fRerender_2eproto_AssignGlobalDescriptors); } I would assume that the ability to import one proto file into another is something that is exercised quite often, so I'm at a loss as to why the resulting code from protoc won't compile. I'm using protobuf 2.0.2 built from source using VS 2008. Any assistance on how to get this working would be greatly appreciated. Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Import broken?
It's not declared there, or anywhere else.I'm using; protoc.exe --cpp_out= [Fully qualified path name] On Oct 9, 2:44 pm, Kenton Varda [EMAIL PROTECTED] wrote: protobuf_BuildDesc_RequestHeader_2eproto() should be declared in RequestHeader.pb.h. Is it not? What exact flags are you passing to protoc? On Thu, Oct 9, 2008 at 8:29 AM, [EMAIL PROTECTED] wrote: I'm in the process of evaluating PB for a distributed cross language project I'm on. I've created a little 'hello world' app to test it's capabilities. I have created 2 simple .proto files, RequestHeader.proto and Rerender.proto. They compile and run as expected. However, if I import RequestHeader into Rerender with the following line: import RequestHeader.proto; I get the following compile error: Error C2039: 'protobuf_BuildDesc_RequestHeader_2eproto' : is not a member of '`global namespace'' The method protobuf_BuildDesc_RequestHeader_2eproto() doesn't exist anywhere in the code except where it errors out. Below is the offending method in Rerender.pb.cc that contains the error: void protobuf_BuildDesc_e_3a_2fVital_203_2e0_2fCPPProtobufTest_2fCPPProtobufTest_2fRerender_2eproto() { static bool already_here = false; if (already_here) return; already_here = true; GOOGLE_PROTOBUF_VERIFY_VERSION; ::google::protobuf::DescriptorPool* pool = ::google::protobuf::DescriptorPool::internal_generated_pool(); ::protobuf_BuildDesc_RequestHeader_2eproto(); // -- ERROR pool-InternalBuildGeneratedFile( \n;e:/Vital 3.0/CPPProtobufTest/CPPProtob ufTest/Rerender.proto\032\023RequestHeader.pro to\\030\n\010Rerender\022\014\n\004Data\030\001 \002(\t, 108, protobuf_BuildDesc_e_3a_2fVital_203_2e0_2fCPPProtobufTest_2fCPPProtobufTest_2fRerender_2eproto_AssignGlobalDescriptors); } I would assume that the ability to import one proto file into another is something that is exercised quite often, so I'm at a loss as to why the resulting code from protoc won't compile. I'm using protobuf 2.0.2 built from source using VS 2008. Any assistance on how to get this working would be greatly appreciated. Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Import broken?
On Thu, Oct 9, 2008 at 12:52 PM, [EMAIL PROTECTED] wrote: protoc.exe --cpp_out= [Fully qualified path name] Ah, ok, you've identified a bug. protoc is supposed to reject any input file which is not located within the import path. The import path is specified using --proto_path and defaults to the current directory. The problem is that protoc detects whether an input file's path is absolute based on whether it starts with a slash, but on Windows absolute paths don't start with a slash. So, protoc failed to report the incorrect input path. To fix this, you can either do: protoc --proto_path=[full path of current directory] --cpp_out=. [full path of input file] Or do: protoc --cpp_out=. [file name without path] I'll make sure the bug gets fixed. Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---