Win10编译和运行grpc

GRPC build and run route_guide

system and configuration: Win10, Visual Studio 2019, VS code
① git clone the repo of grpc

$ git clone https://github.com/grpc/grpc.git


if update submodule fail,

$ git submodule update --init

then, download the corresponding version zip file included in thirt_party
在这里插入图片描述
rename to: abseil-cpp, cares, protobuf, re2, zlib
then, put cares into grpc/thirt_party/cares, put others into grpc/third_party
③build grpc, add build.bat at grpc directory

RMDIR /Q /S build_release
MKDIR build_release
PUSHD build_release 
cmake .. -G "Visual Studio 16"
cmake --build . --config Release
cmake --install . --config Release
POPD

④copy protoc.exe and grpc_cpp_plugin.exe at C:\Program Files (x86)\grpc\bin(or C:\Program Files \grpc\bin) to grpc\examples\cpp\route_guide directory

⑤ build route_guide, add build.bat at route_guide directory

protoc -I ../../protos --grpc_out=. --plugin=protoc-gen-grpc=grpc_cpp_plugin.exe ../../protos/route_guide.proto
protoc -I ../../protos --cpp_out=. ../../protos/route_guide.proto
RMDIR /Q /S build_debug
MKDIR build_release
PUSHD build_release
cmake .. -G "Visual Studio 16"
cmake --build . --config Release
POPD

build error:

在这里插入图片描述

analysis error refer to linker below:

https://blog.csdn.net/zxj1988/article/details/8642910

solution:

link to grpc_unsecure.lib
在这里插入图片描述
在这里插入图片描述
⑥run server and client at route_guide directory

$ .\build_release\Release\route_guide_server.exe
$ .\build_release\Release\route_guide_client.exe
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值