1024programmer Blog Notes on gRPC installation under Windows_grpc_cli_captainwong’s blog

Notes on gRPC installation under Windows_grpc_cli_captainwong’s blog

class=”markdown_views prism-atom-one-dark”>


layout: post
title: “Windows Notes on gRPC installation “
subtitle: “The experience of rolling in the pit again…”
date: “2016-07-12”
author: “cj”
tags:
proto3
protobuf
gRPC
windows
c++

After finishing proto3, start working on gRPC. Another giant pit.

After github clone project, open grpc.sln in vsprojects, compile gpr, gprc, gprc_unsecure, gprc++_unsecure several projects, and generate lib library. Since boringsll cannot be used, only the unencrypted version can be used. During the period, there were countless small pits, and each project configuration had to be Mt or Mtd.
Open grpc_protoc_plugin.sln again, compile grpc_plugin_support, gprc_cpp_plugin two projects. The grpc_cpp_plugin.exe file will be generated, which can be placed in the protoc path and added to the system path for easy use.

After completing the prerequisites, go to the example/protos folder and generate the pb of protoc:

protoc --cpp_out=.helloworld.proto
 

Two files, helloworld.pb.h and helloworld.pb.cc, will be generated.

Use the grpc plug-in to generate the pb of gprc:

protoc --grpc_out=. --plugin=protoc-gen-grpc="your-grpc-cpp-plugin-exe-path" helloworld.proto
 

Generate helloworld.grpc.pb.h and helloworld.grpc.pb.cc two files.

Add the above 4 files to the newly created sample project, add the src folder path in the protobuf3 library and the include folder path in the grpc library in the c/c++ Additional Include Directories of the project properties. Add the output path of vsprojects in protobuf and grpc in Additional Library Directories, or debug or release . Add the following lib library in the Additional Dependencies of Linker->Input:

libprotobuf.lib
 z.lib
 gpr.lib
 grpc_unsecure.lib
 grpc++_unsecure.lib
 

Compile and I get another bunch of linking errors. Don’t be afraid! At least explaining that the code is okay is a matter of configuration (nonsense, what’s wrong with Google’s sample code). Analyze the link errors of the sample project, generally unresolved external symbol, which means that there is a declaration in the header file, but the implementation cannot be found. According to my previous experience in configuring proto3, continue to find c or cc files that have not been added to the project.

After all these are done, there are still two pits. . .
One is that the properties of the sample project must be set to Mtd or Mt, and the other is that if the project uses a precompiled header, it must be added to the first non-comment line of the generated pb.cc file

#include "  stdafx.h"
 

OK, I have never seen such a big storm, Wallace in the United States, I am talking and laughing with him! How can this little difficulty stump me! Continue to study another example project route_guid to go also.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/notes-on-grpc-installation-under-windows_grpc_cli_captainwongs-blog/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索