使用 VS 2015 编译 Protocol Buffers 2.6.1? [英] Compile Protocol Buffers 2.6.1 using VS 2015?

查看:36
本文介绍了使用 VS 2015 编译 Protocol Buffers 2.6.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 VS 2015 C++ 应用程序中使用 ProtoBuf 2.6.1.但是,我无法链接使用 VS 2013 编译的 libprotobuf.lib.我尝试使用 VS 2015 再次编译 libprotobuf.lib,但遇到编译错误,抱怨关于 被弃用.

I want to use ProtoBuf 2.6.1 with a VS 2015 C++ application. However, I can't link against libprotobuf.lib compiled using VS 2013. I tried to compile libprotobuf.lib again using VS 2015, but am running into compile errors, complaining about <hash_map> and <hash_set> being deprecated.

看起来 GitHub 存储库中 ProtoBuf 的 cmake 文件现在都已为 ProtoBuf 3.0 设置.是否仍然可以使用 VS 2015 编译 libprotobuf?

It looks like the cmake files for ProtoBuf at the GitHub repo are now all set up for ProtoBuf 3.0. Is it still possible to compile libprotobuf using VS 2015?

推荐答案

不幸的是,cmake build 从 protobuf v3.0.0-alpha 开始可用.

Unfortunately, cmake build is available starting from protobuf v3.0.0-alpha.

我已经使用以下非官方 cmake 脚本 成功构建了带有 MSVC 2015 的 protobuf v2.6.1.您需要该存储库中的分支 updated_for_v2.6.1.

I've successfully built protobuf v2.6.1 with MSVC 2015 using following unofficial cmake scripts. You need branch updated_for_v2.6.1 from that repository.

对于该克隆,两个存储库 - protobufprotobuf-cmake.

For that clone both repositories - protobuf and protobuf-cmake.

protobuf clone 中的 Checkout tag v2.6.1 和 protobuf-cmake 中的分支 origin/updated_for_v2.6.1

Checkout tag v2.6.1 in protobuf clone and branch origin/updated_for_v2.6.1 in protobuf-cmake

cmake <这里是 protobuf-cmake 克隆的路径 > -DPROTOBUF_ROOT=<这里是 protobuf 克隆的路径 > -G"Visual Studio 14 2015" -DCMAKE_INSTALL_PREFIX= <这里是安装目标的路径>

cmake < here path to protobuf-cmake clone > -DPROTOBUF_ROOT=< here path to protobuf clone > -G"Visual Studio 14 2015" -DCMAKE_INSTALL_PREFIX= < here path for install target >

然后像往常一样从打开的解决方案或使用cmake --build"构建它.命令

Then build it as usual either from opened solution or using "cmake --build ." command

HTH.

这篇关于使用 VS 2015 编译 Protocol Buffers 2.6.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆