C++ 无法在Windows中链接grpc库

C++ 无法在Windows中链接grpc库,c++,windows,cmake,grpc,vcpkg,C++,Windows,Cmake,Grpc,Vcpkg,我已经在windows中使用vcpkg安装了grpc:x64,我正在尝试编译基本的迎宾服务器程序。但它给了我链接错误。即使find_package命令能够找到grpc包,我怀疑库路径设置不正确。我无法找出这个问题的确切原因。如果find_包成功,我是否必须显式提供库路径 操作系统:Windows 10 工具链:Visual Studio 15 cmake_minimum_required( VERSION 3.1 ) project( test ) find_package(gRPC CO

我已经在windows中使用vcpkg安装了grpc:x64,我正在尝试编译基本的迎宾服务器程序。但它给了我链接错误。即使find_package命令能够找到grpc包,我怀疑库路径设置不正确。我无法找出这个问题的确切原因。如果find_包成功,我是否必须显式提供库路径

操作系统:Windows 10
工具链: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 )

cmake_最低要求(3.1版) 项目(测试) 查找_包(需要gRPC配置) 查找_包(需要Protobuf) 添加可执行文件(${PROJECT\u NAME}src/main.cpp proto/hello\u world.grpc.pb.cc proto/hello\u world.pb.cc) 目标链接库(${PROJECT_NAME}私有gRPC::gRPC++gRPC::gpr gRPC::gRPC gRPC::gRPC++gRPC::gRPC_cronet protobuf::libprotoc protobuf::libprotobuf::libprotobuf lite) 在运行基本问候语服务器程序时,我遇到以下错误

1> ------已开始构建:项目:测试,配置:版本x64------
1> main.obj:错误LNK2019:未解析的外部符号“void\uu cdecl grpc\u impl::reflection::InitProtoReflectionServerBuilderPlugin(void)”(?InitProtoReflectionServerBuilderPlugin@reflection@grpc_impl@@YAXXZ)在函数“void_ucdecl RunServer(void)”中引用(?RunServer@@YAXXZ) 1> C:\all\u files\junkyard\u grpc\build\Release\test.exe:致命错误LNK1120:1未解析的外部 2> ----跳过生成:项目:所有生成,配置:版本x64------ 2> 未选择要为此解决方案配置生成的项目 =======生成:0成功,1失败,1最新,1跳过========== 如果您有任何关于识别问题的建议,我们将不胜感激。谢谢。
找到了丢失的库<代码>gRPC::gRPC++\u反射需要添加到依赖项列表中

请完整添加错误消息,并将其作为文本,而不是图像。 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 ==========