milvus-sdk-cpp icon indicating copy to clipboard operation
milvus-sdk-cpp copied to clipboard

undefined references for grpc and google protobuf

Open Lllll921 opened this issue 2 years ago • 1 comments

Hi, I have installed Milvus C++ sdk on my machine. But when I compile my project, it shows undefined reference to 'grpc::xxx‘ or undefined reference to 'google::protobuf::xx' even though I have include the grpc++ and protobuf library in my CMakeLists. Can you provide the solution for this problem? Thanks!

Lllll921 avatar Jun 27 '23 08:06 Lllll921

By default, the milvus-cpp-sdk are compiled with static lib. So you need to link grpc++ again in your project. I good solution is to switch to shared library for milvus-cpp-sdk. You could try adding -DBUILD_SHARED_LIBS=YES during cmake.

I'm not very sure if we need change the default with BUILD_SHARED_LIBS=YES ...

matrixji avatar Jul 03 '23 15:07 matrixji