大数据最全win10系统 C++环境 安装编译GRPC_windows下grpc安装教程c++(1),2024年最新2024年大数据开发大厂面试

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

[submodule “third_party/benchmark”]
path = third_party/benchmark
#url = https://github.com/google/benchmark
url = https://gitee.com/mirrors/google-benchmark.git
[submodule “third_party/boringssl-with-bazel”]
path = third_party/boringssl-with-bazel
#url = https://github.com/google/boringssl.git
url = https://gitee.com/mirrors/boringssl.git
[submodule “third_party/re2”]
path = third_party/re2
#url = https://github.com/google/re2.git
url = https://gitee.com/local-grpc/re2.git
[submodule “third_party/cares/cares”]
path = third_party/cares/cares
#url = https://github.com/c-ares/c-ares.git
url = https://gitee.com/mirrors/c-ares.git
branch = cares-1_12_0
[submodule “third_party/bloaty”]
path = third_party/bloaty
#url = https://github.com/google/bloaty.git
url = https://gitee.com/local-grpc/bloaty.git
[submodule “third_party/abseil-cpp”]
path = third_party/abseil-cpp
#url = https://github.com/abseil/abseil-cpp.git
url = https://gitee.com/mirrors/abseil-cpp.git
branch = lts_2020_02_25
[submodule “third_party/envoy-api”]
path = third_party/envoy-api
#url = https://github.com/envoyproxy/data-plane-api.git
url = https://gitee.com/local-grpc/data-plane-api.git
[submodule “third_party/googleapis”]
path = third_party/googleapis
#url = https://github.com/googleapis/googleapis.git
url = https://gitee.com/mirrors/googleapis.git
[submodule “third_party/protoc-gen-validate”]
path = third_party/protoc-gen-validate
#url = https://github.com/envoyproxy/protoc-gen-validate.git
url = https://gitee.com/local-grpc/protoc-gen-validate.git
[submodule “third_party/udpa”]
path = third_party/udpa
#url = https://github.com/cncf/udpa.git
url = https://gitee.com/local-grpc/udpa.git
[submodule “third_party/libuv”]
path = third_party/libuv
#url = https://github.com/libuv/libuv.git
url = https://gitee.com/mirrors/libuv.git


在grpc目录下,在git 上使用更新命令



cd grpc
git submodule update --init


使用cmake对grpc进行编译。  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/e527b87f5032438eaad0f7965d78349f.png)


编译结束后,使用vs打开目录中的grpc.sln文件  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/a4fa461f78a44c0e9fc6cc6a72bcbf3f.png)  
 右键ALL——BUILD,点击重新生成。  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/a51f3a311edf4677a2a08921656b9545.png)


### 第二步 编写 .proto 文件


新建一个C++控制台项目,新建 demo.proto 文件  
 文件内容:



syntax = “proto3”;

package hello;

service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}

message HelloRequest {
string message = 1;
}

message HelloReply {
string message = 1;
}


在资源文件中右键添加现有项,将demo.proto 文件添加进来。  
 demo.proto里面不能有中文或者utf-8的格式


### 第三步 生成头文件与源文件


在自己新建的控制台项目中,按住Shift + 右键 调处控制台  
 接下来我们利用grpc编译后生成的proc.exe生成proto的头文件和源文件



D:\cpp_grpc\visualpro\third_party\protobuf\Debug\protoc.exe -I=“.” --grpc_out=“.” --plugin=protoc-gen-grpc=“D:\cpp_grpc\visualpro\Debug\grpc_cpp_plugin.exe” “demo.proto”



D:\cpp_grpc\visualpro\third_party\protobuf\Debug\protoc.exe --cpp_out=. “demo.proto”


![在这里插入图片描述](https://img-blog.csdnimg.cn/55147d8ea8014c07aeb9f42fb17f1a69.png)  
 生成出来的文件:  
 ![](https://img-blog.csdnimg.cn/46772038b7984130bd95fd49610ec623.png)


### 第四步 配置VS


将这4个都右键添加现有项的方法添加到C++的控制台项目中去。  
 开始配置VS  
 右键项目,点击属性,选择c/c++,选择常规,选择附加包含目录



D:\cpp_grpc\grpc\third_party\re2
D:\cpp_grpc\grpc\third_party\address_sorting\include
D:\cpp_grpc\grpc\third_party\abseil-cpp
D:\cpp_grpc\grpc\third_party\protobuf\src
D:\cpp_grpc\grpc\include


![在这里插入图片描述](https://img-blog.csdnimg.cn/07b171848e1f4cc688bbd6be70263d1d.png)


接下来配置库路径, 在链接器常规选项下,点击附加库目录,添加我们需要的库目录。


右键项目,点击属性,选择链接器,选择附加库目录



D:\cpp_grpc\visualpro\third_party\re2\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\types\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\synchronization\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\status\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\random\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\flags\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\debugging\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\container\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\hash\Debug
D:\cpp_grpc\visualpro\third_party\boringssl-with-bazel\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\numeric\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\time\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\base\Debug
D:\cpp_grpc\visualpro\third_party\abseil-cpp\absl\strings\Debug
D:\cpp_grpc\visualpro\third_party\protobuf\Debug
D:\cpp_grpc\visualpro\third_party\zlib\Debug
D:\cpp_grpc\visualpro\Debug
D:\cpp_grpc\visualpro\third_party\cares\cares\lib\Debug


![在这里插入图片描述](https://img-blog.csdnimg.cn/e70189d9bebb4a47aec700de3f3b9608.png)  
 另外,我们虽然配置了库目录,但还要将要使用的库链接到项目  
 点击链接器,选择输入选项,点击附加依赖项,添加依赖的库名字



libprotobufd.lib
gpr.lib
grpc.lib
grpc++.lib
grpc++_reflection.lib
address_sorting.lib
ws2_32.lib
cares.lib
zlibstaticd.lib
upb.lib
ssl.lib
crypto.lib
absl_bad_any_cast_impl.lib
absl_bad_optional_access.lib
absl_bad_variant_access.lib
absl_base.lib
absl_city.lib
absl_civil_time.lib
absl_cord.lib
absl_debugging_internal.lib
absl_demangle_internal.lib
absl_examine_stack.lib
absl_exponential_biased.lib
absl_failure_signal_handler.lib
absl_flags.lib
absl_flags_config.lib
absl_flags_internal.lib
absl_flags_marshalling.lib
absl_flags_parse.lib
absl_flags_program_name.lib
absl_flags_usage.lib
absl_flags_usage_internal.lib
absl_graphcycles_internal.lib
absl_hash.lib
absl_hashtablez_sampler.lib
absl_int128.lib
absl_leak_check.lib
absl_leak_check_disable.lib
absl_log_severity.lib
absl_malloc_internal.lib
absl_periodic_sampler.lib
absl_random_distributions.lib
absl_random_internal_distribution_test_util.lib
absl_random_internal_pool_urbg.lib
absl_random_internal_randen.lib
absl_random_internal_randen_hwaes.lib
absl_random_internal_randen_hwaes_impl.lib
absl_random_internal_randen_slow.lib
absl_random_internal_seed_material.lib
absl_random_seed_gen_exception.lib
absl_random_seed_sequences.lib
absl_raw_hash_set.lib
absl_raw_logging_internal.lib
absl_scoped_set_env.lib
absl_spinlock_wait.lib
absl_stacktrace.lib
absl_status.lib
absl_strings.lib
absl_strings_internal.lib
absl_str_format_internal.lib
absl_symbolize.lib
absl_synchronization.lib
absl_throw_delegate.lib
absl_time.lib
absl_time_zone.lib
absl_statusor.lib
re2.lib


![在这里插入图片描述](https://img-blog.csdnimg.cn/620fb8e4f92749f7bab04f0492893bb9.png)


### 第五步 编写服务端代码:



![img](https://img-blog.csdnimg.cn/img_convert/5a38f21ce4b0b6f248193373689b519e.png)
![img](https://img-blog.csdnimg.cn/img_convert/09819e5663758bcd102e2d6097dc4d47.png)
![img](https://img-blog.csdnimg.cn/img_convert/f4ea0d13c414b0ac1fce4511c9f12c0b.png)

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)**

片转存中...(img-KRPA4Wuh-1715423657840)]

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)**

  • 16
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是在 Windows 上编译 gRPC 的详细步骤: 1. 安装 Git 和 Visual Studio 在 Windows 上编译 gRPC,您需要先安装 Git 和 Visual Studio。您可以从以下链接下载和安装它们: - Git:https://git-scm.com/downloads - Visual Studio:https://visualstudio.microsoft.com/downloads/ 2. 克隆 gRPC 代码库 打开 Git Bash 或者其他命令行工具,输入以下命令来克隆 gRPC 代码库: ``` git clone -b v1.38.x https://github.com/grpc/grpc.git ``` 3. 安装依赖库 在 Windows 上编译 gRPC,您还需要安装一些依赖库,包括 OpenSSL 和 protobuf。您可以使用 vcpkg 工具来安装它们。以下是安装步骤: - 下载 vcpkg 工具:https://github.com/microsoft/vcpkg - 打开命令行工具,进入 vcpkg 目录,使用以下命令安装 OpenSSL 和 protobuf: ``` .\vcpkg.exe install openssl:x64-windows protobuf:x64-windows ``` 4. 生成 Visual Studio 解决方案和项目 进入 gRPC 代码库的根目录,在命令行工具中输入以下命令来生成 Visual Studio 解决方案和项目: ``` mkdir cmake_build cd cmake_build cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=..\third_party\vcpkg\scripts\buildsystems\vcpkg.cmake -DgRPC_SSL_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package .. ``` 5. 构建 gRPC 打开生成的 Visual Studio 解决方案,选择 "Release" 配置,然后构建 gRPC 项目。 您可以使用 Visual Studio 中的菜单或者使用以下命令来构建: ``` cmake --build . --config Release ``` 6. 运行测试 构建完成后,在命令行工具中输入以下命令来运行 gRPC 的测试: ``` cd grpc cmake --build . --config Release --target grpc_cli cd cmake_build ctest -C Release --output-on-failure -j 4 ``` 以上就是在 Windows 上编译 gRPC 的步骤。注意,实际情况可能会因不同的环境而有所不同,这只是一个简单的指南。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值