milvus-io / milvus-sdk-cpp

C++ SDK for Milvus 2.0
Apache License 2.0
35 stars 21 forks source link

undefined references for grpc and google protobuf #241

Open Lllll921 opened 1 year ago

Lllll921 commented 1 year ago

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!

matrixji commented 1 year ago

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 ...