windows编译protobuf库(用Visual Studio编译)
第一步:下载cmake、Visual Studio;
cmake:https://cmake.org/download/ 下载 cmake-3.9.0-rc3-win64-x64.msi
Visual Studio 官网 下载Visual Studio community 2017版
第二步:从github官网克隆protobuf源码;
D:\>git clone -b [release_tag] https://github.com/google/protobuf.git
D:\>cd protobuf
D:\>git clone -b release-1.7.0 https://github.com/google/googlemock.git gmock
D:\>cd gmock
D:\gmock>git clone -b release-1.7.0 https://github.com/google/googletest.git gtest
第三步:打开cmake可视化界面,填写内容如下图,然后分别执行Configure和Generate(相当于cmake);
第四步:点击Open Project,编译INSTALL工程,即可在D:FFFF/installlll找到生成的protoc.exe和lib静态库文件,搞定。
如果出现了任何问题,可以选择用minGW编译,参考我的另一篇博客:
http://blog.csdn.net/jack_20/article/details/73549523
注意:如果想要将生成的静态库最为Qt Creator的依赖项,需选择Generator:Visual Studio 15 2017 Win64,然后打开工程编译INSTALL时选择Debug模式,Win64的编译方式。测试过,这样生成的静态库才可以在Qt中使用。