无法 link Windows 中的 grpc 库
Unable to link the grpc libraries in Windows
我已经在 windows 中使用 vcpkg 安装了 grpc:x64,我正在尝试编译基本的欢迎服务器程序。但它给了我链接错误。即使 find_package 命令能够找到 grpc 包,我怀疑库路径设置不正确。我无法弄清楚这个问题的确切原因。如果 find_package 成功,我是否必须明确提供库路径?
OS: Windows 10
工具链:Visual Studio15
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 )
我在基本问候服务器程序时收到以下错误
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 ==========
确定问题的任何指示都将是 appreciated.Thanks。
找出丢失的库。 gRPC::grpc++_reflection
需要添加到依赖列表中。
我已经在 windows 中使用 vcpkg 安装了 grpc:x64,我正在尝试编译基本的欢迎服务器程序。但它给了我链接错误。即使 find_package 命令能够找到 grpc 包,我怀疑库路径设置不正确。我无法弄清楚这个问题的确切原因。如果 find_package 成功,我是否必须明确提供库路径?
OS: Windows 10
工具链:Visual Studio15
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 )
我在基本问候服务器程序时收到以下错误
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 ==========
确定问题的任何指示都将是 appreciated.Thanks。
找出丢失的库。 gRPC::grpc++_reflection
需要添加到依赖列表中。