You need to use a consistent --proto_path.

On Tue, Oct 12, 2010 at 12:37 PM, DAldridge <[email protected]> wrote:

>  protoc.exe --proto_path=foolib --cpp_out=foolib foolib\foo.proto
>

Here, because you specified --proto_path=foolib, and because foo.proto is
inside foolib, protoc decides that foo.proto's canonical name is
"foo.proto", not "foolib/foo.proto".


>  protoc.exe --proto_path=barlib --protopath=. --cpp_out=barlib barlib
> \bar.proto
>

But bar.proto imports "foolib/foo.proto".  This import resolves because you
specified --proto_path=.  So in this case, protoc thinks that foo.proto's
canonical name is "foolib/foo.proto", which doesn't match what it concluded
when you compiled foo.proto itself.  Hence the error.

The resolution is to use only --proto_path=. in both cases.  Do not specify
--proto_path=foolib nor --proto_path=barlib.

We should probably print a warning when one --proto_path is a subdirectory
of another, since this usually indicates that --proto_path is being used
incorrectly.  In general, it should always point at the root of the source
tree.

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

Reply via email to