How To Export Compiled Protobuf to Static Library C++

332 views
Skip to first unread message

Peter Boshra

unread,
Jun 8, 2022, 9:48:40 AM6/8/22
to Protocol Buffers
I want to make a static library containing .cc and .h files that are generated from protoc compiler to link with it from other project, I'm using C++

Deanna Garcia

unread,
Aug 1, 2022, 1:51:05 PM8/1/22
to Protocol Buffers
In general, we do not recommend distributing generated code. Doing so requires that all users of the code use the same protobuf runtime which can cause unexpected errors if the runtimes don't match. Additionally, these files will not be updated if the `.proto` file is updated which could cause inconsistencies between usages of protobuf.

If you still want to do it, the best way would be to write your own rule or manually copy the generated files from running `protoc --cpp_out`.

Reply all
Reply to author
Forward
0 new messages