What command are you using to invoke protoc? This sort of problem usually
occurs when you don't use the same root directory in protoc invocations. So
you should have something like:

protoc --proto_path .\ProtoTopDir A.proto
protoc --proto_path .\ProtoTopDir Dir\B.proto Dir\C.proto

I'm not sure the issue that you have with using a single command, but
perhaps you're doing something like
protoc --proto_path .\ProtoTopDir --proto_path .\ProtoTopDir\Dir A.proto
B.proto C.proto ...

In this case, when you read A.proto, it will search for the import
Dir\B.proto, and add those definitions. Then when it reads B.proto, it finds
it in the second --proto_path, but these definitions are duplicated with
what's already been read as Dir\B.proto via A's import. protoc doesn't do
path canonicalization, as this gets complicated with . and ../, symlinks,
etc etc.

On Fri, Jul 29, 2011 at 2:49 AM, elimn8or <john_paul_re...@hotmail.com>wrote:

> My Scenario:
>
> I have defined four proto message types: A, B, C, D and want to
> compile using the C++ option. Proto file A is located in directory .
> \ProtoTop and proto files B, C, D are located in directory .\ProtoTop
> \Dir. The resulting class dependencies are A->B->C->D ( where -> is
> defines as depends on ). I have made this directory structure to
> accomadate the eventual build of libraries ( Msgs & Types ). Proto
> message class A does a import "Dir/B.proto".
> I have tried packaging each proto file to remove namespace conflicts
> but no joy.
>
> The problems:
>
> 1) When I compile each class individually all is well and the source
> code is autogenerated. However there is a function called from A that
> is defined in B which does not
> exist:  ::protobuf_AddDesc_Dir_2fB_2eproto() and as such a compilation
> error for A occurs in my c++ compile (VC90 version).
>
> Note: B contains what i believe is the intended
> function ::protobuf_AddDesc_B_2eproto(); Therefore it seems the
> autogenerated class A adds the import path into the function name for
> the above method.
>
> Can I get around this without excplicity editing autogenerated code,
> what did I do incorrectly?
>
> 2) I next tried compiling all proto files in one go, i.e one call to
> protoc with the intention of mitigating the above problem. However,
> this produces the following protoc errors:
>
> B.proto:6:30: ".B.C" is already defined in file "Dir/B.proto".
> 1>B.proto:4:9: ".B" is already defined in file "Dir/B.proto".
>
> Summary:
> The only methodology I have succeeded with is to compile all proto
> files in one directory within the same namespace. This will suffice,
> however it contrains my design and usage of the libraries in that I
> would be unable to seperate my 'messages' from my 'message types'.
>
>
> --
> 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.
>
>

-- 
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.

Reply via email to