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.
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".
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 firstname.lastname@example.org.
To unsubscribe from this group, send email to
For more options, visit this group at