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 */

猜你喜欢

转载自blog.csdn.net/m0_37981386/article/details/80757824