You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked the source code and this line parses "google/protobuf/descriptor.proto" under the import Path by default. In actuality, I'm not using "google/protobuf/descriptor.proto" in my every proto file, but "common/google/protobuf/descriptor.proto".
Expected results
i do not want to the error symbol "google.protobuf.FileDescriptorSet" already defined at google/protobuf/descriptor.proto:57:9
The text was updated successfully, but these errors were encountered:
@FGYFFFF, the problem is the way you are importing it, with the "common/" prefix. In general, a file should always be imported using its canonical import path, which in this case is "google/protobuf/descriptor.proto".
So a work-around here is to strip the "common" prefix from your source imports and add <include-dir>/common as one of the import paths.
An alternate work-around, if you insist on keeping the "common" prefix in your imports, would be to handle this in your WrapSourceResolver implementation: when it is invoked with a path of "google/protobuf/descriptor.proto", have it immediately return a "file not found" error instead of delegating to its SourceResolver field.
To be clear, the "google/protobuf/descriptor.proto" file that is included in the compile is the one provided by the compiler's configured source resolver. This is tentatively included in every compile so that the compiler knows what version of options messages to use when interpreting options, even in files that do not explicitly import any version of the file. So if you do not provide any such file, it will not be included in the compile.
For the files that actually a import a different path (the one with the "common/" prefix), the correct version of options messages will be used since the actual transitive dependency graph of a file is consulted first when looking for the options messages definitions.
Description of the problem
At the same time "google/protobuf/descriptor.proto" is also in "/usr/local/include".
the
Compiler.Compile()
will return errsymbol "google.protobuf.FileDescriptorSet" already defined at google/protobuf/descriptor.proto:57:9
Expected results
i do not want to the error
symbol "google.protobuf.FileDescriptorSet" already defined at google/protobuf/descriptor.proto:57:9
The text was updated successfully, but these errors were encountered: