Based on a [HelloWorld][1] from grpc, I have created a project with my own
proto file. This proto file also imports another proto file in the same
directory:
MainProto.proto:
syntax = "proto3";
package MyProject;
option csharp_namespace = "MyProject";
option optimize_for = SPEED;
option cc_enable_arenas = true;
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "CommonUtils.proto";
....
Followed by a bunch of enums, messages and services, some of which use the
enums/messages from CommonUtils.proto.
In the CMakeLists.txt file, I generate the .cc and .hh based on the
MainProto.proto file. However, this does not seem to generate the necessary
files for CommonUtils.proto, which are then detected as errors in
MainProto.pb.h and the other generated header files.
My question is:
1. How do I modify my CMakeLists or Makefile to also build the headers and
cc files for CommonUtils?
2. How do I link the generated files together to avoid "unresolved
external symbol" errors?
I have tried replacing the proto file in my CMakeList.txt file (the lines #
Proto file and # Generating source) with the CommonUtils.proto, and then
replacing it and running with the original MainProto.proto, but I get a
bunch of unresolved external symbol errors in the generated MainProto.pb.h
for all the fields that should be imported from CommonUtils.proto.
My CMakeLists.txt is similar to the HelloWorld, with only
greeter_async_client and greeter_async_server and the rest removed, and my
Makefile is the same as the example.
See my full file text in nice formatting
here
https://stackoverflow.com/questions/65433642/linking-imported-proto-file-in-cmakelists-txt
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/a9cbcaa8-041c-467b-bd92-43f1f8340816n%40googlegroups.com.