protobuf window下的配置安装

下载 protobuf 、cmake、zlib
https://github.com/google/protobuf/releases

https://cmake.org/download/

http://gnuwin32.sourceforge.net/packages/zlib.htm


下载 protobuf-cpp-3.6.0.zip,cmake-3.12.0-rc1-win64-x64.msi,zlib-1.2.3.exe,安装。

打开cmake,在第一个栏填上你下载的protubuf目录中的cmake目录,第二栏 填上protubuf编译后的目录


然后点configure,会弹出以提示框,一切默认就好,然后点 finish

然后点击Generate,如果成功,进入编译好的目录

用vs 打开 protobuf.sln

一定要选中 libprotobuf 设置为启动项目,然后编译,在编译protoc,在编译后目录下有一个debug或release 文件



        protoc --cpp_out=./ Protocal.proto


参考这篇博客  https://blog.csdn.net/program_anywhere/article/details/77365876




遇到缺少unistd.h错误  ,在libprotobuf下添加新建unistd.h,给文件添加下面内容(只有下面这些内容)

/** This file is part of the Mingw32 package.
*  unistd.h maps     (roughly) to io.h
*/
#ifndef _UNISTD_H
#define _UNISTD_H
#include <io.h>
#include <process.h>
#endif /* _UNISTD_H */

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值