Hi,
I've been trying to integrate the simple C++ callback example into my application to make sure I can compile it successfully before implementing my full protocol. However, I'm getting linker errors and can't spot what I might have missed.
I've really just copied the greeter_callback_server.cc contents and put it in my app. My linker settings look like:
-lgrpc -lgrpc++ -lgpr -labsl_synchronization -lprotobuf -lgrpc_plugin_support -L/opt/grpc/v1.50.1/lib
after having compiled and installed using CMake.
The errors I'm seeing are:
/usr/bin/ld: grpc_server.o: in function `GrpcServer::CreateServer()':
grpc_server.cc:(.text+0x2e5): undefined reference to `grpc::reflection::InitProtoReflectionServerBuilderPlugin()'
/usr/bin/ld: grpc_server.o: in function `helloworld::Greeter::WithCallbackMethod_SayHello<helloworld::Greeter::Service>::~WithCallbackMethod_SayHello()':
grpc_server.cc:(.text._ZN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEED2Ev[_ZN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEED5Ev]+0xb): undefined reference to `helloworld::Greeter::Service::~Service()'
/usr/bin/ld: grpc_server.o: in function `helloworld::Greeter::WithCallbackMethod_SayHello<helloworld::Greeter::Service>::WithCallbackMethod_SayHello()':
grpc_server.cc:(.text._ZN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEEC2Ev[_ZN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEEC5Ev]+0x26): undefined reference to `helloworld::Greeter::Service::Service()'
/usr/bin/ld: grpc_server.cc:(.text._ZN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEEC2Ev[_ZN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEEC5Ev]+0x1b1): undefined reference to `helloworld::Greeter::Service::~Service()'
/usr/bin/ld: grpc_server.o:(.data.rel.ro._ZTIN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEEE[_ZTIN10helloworld7Greeter27WithCallbackMethod_SayHelloINS0_7ServiceEEE]+0x10): undefined reference to `typeinfo for helloworld::Greeter::Service'
collect2: error: ld returned 1 exit status