Reputation: 406
I have installed grpc:x64 using vcpkg in windows and I am trying to compile the basic greeter server program. But it is giving me linking errors. Even though the find_package command is able to find the grpc package, I suspect that the library paths are not set properly. I am not able to figure out the exact reason for this issue. If find_package is successful, do I have to provide the library paths explicitly?
OS: Windows 10
Tool chain: Visual Studio 15
cmake_minimum_required( VERSION 3.1 ) project( test ) find_package(gRPC CONFIG REQUIRED) find_package( Protobuf REQUIRED ) add_executable( ${PROJECT_NAME} src/main.cpp proto/hello_world.grpc.pb.cc proto/hello_world.pb.cc) target_link_libraries( ${PROJECT_NAME} PRIVATE gRPC::grpc++ gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc_cronet protobuf::libprotoc protobuf::libprotobuf protobuf::libprotobuf-lite )
I am getting the following errors while the basic greeting server program
1>------ Build started: Project: test, Configuration: Release x64 ------
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl grpc_impl::reflection::InitProtoReflectionServerBuilderPlugin(void)" (?InitProtoReflectionServerBuilderPlugin@reflection@grpc_impl@@YAXXZ) referenced in function "void __cdecl RunServer(void)" (?RunServer@@YAXXZ) 1>C:\all_files\junkyard\_grpc\build\Release\test.exe : fatal error LNK1120: 1 unresolved externals 2>------ Skipped Build: Project: ALL_BUILD, Configuration: Release x64 ------ 2>Project not selected to build for this solution configuration ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========
Any pointers in identifying the issue will be appreciated.Thanks.
Upvotes: 4
Views: 2702
Reputation: 406
Figured out the missing library. gRPC::grpc++_reflection
needs to be added in the dependency list.
Upvotes: 7