[C.C++] protobuf-c编译成c语言,protobuf工程的编译以及使用

637 0
Honkers 2025-3-27 10:47:38 来自手机 | 显示全部楼层 |阅读模式

一. 获取Protocol Buffer

1.1 获得源码

Git clone之:git clone https://github.com/google/protobuf.git

本例选择从release下载3.7.0版本

下载并解压到目录: D:\wzx\protobuf\protobuf-3.7.0

1.2 编译protoc.exe(Windows平台)

准备工具: VS2017(包含C++模块),

提取码:jwa7

1.打开cmake目录,运行cmakegui:

D:\wzx\protobuf\cmake-3.14.0-win64-x64\bin\cmake-gui.exe

2.配置选项:

Source Code目录: D:/wzx/protobuf/protobuf-3.7.0/cmake

build the binaries目录:D:/wzx/protobuf/cmake-3.14.0-win64-x64/bin/protobuf-build

菜单栏Tools->configure,选择generator:本例使用VS2017 64位版本,所以选择:Visual Studio 15 2017

4.点击finish,结果如下图:

5.将列表中的protobuf_BUILD_SHARED_LIBS勾上, 然后generator。<

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Honkers

荣誉红客

关注
  • 4010
    主题
  • 36
    粉丝
  • 0
    关注
这家伙很懒,什么都没留下!

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2025 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行