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