Use of import breaks generated code!

Skip to first unread message

Anders Thernström

Aug 20, 2021, 4:49:39 AMAug 20
to Protocol Buffers
I'm converting a proto2 c interface to a proto3 c++ interface and have stumbled upon a problem related to import of proto files. Version 3.11.4 of protocol buffers is used in a Debian 10 environment.

I have a general.proto file which is imported by numerous other proto-files and this worked fine with the old setup but the proto3 version of the generated code won't compile due to that a reference to a feature in general.pb.h is wrong giving compile errors like:
src/generated/ error: ‘PROTOBUF_INTERNAL_EXPORT_General_2eproto’ does not name a type; did you mean ‘PROTOBUF_INTERNAL_EXPORT_General_5fclean_2eproto’?
extern PROTOBUF_INTERNAL_EXPORT_General_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Result_General_2eproto;

The suggested reference is the correct one and if I a manually replace PROTOBUF_INTERNAL_EXPORT_General_2eproto with PROTOBUF_INTERNAL_EXPORT_General_5fclean_2eproto the file will compile.

If I merge all proto-files to one file to avoid using import everything works fine.

Any ideas for how to solve this besides from using one huge proto-file?

Reply all
Reply to author
0 new messages