Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Protocol Buffers 2.6.1 using VS 2015?

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.

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?

like image 320
Ionian316 Avatar asked Jul 28 '15 16:07

Ionian316


People also ask

Is Protobuf backwards compatible?

Protocol buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data in a forward-compatible and backward-compatible way.

How do I check Protobuf version?

To check which version of protobuf is installed, use pip show protobuf or pip3 show protobuf in your Windows CMD, command line, or PowerShell.

Where is protocol buffer used?

In particular, it was designed to be smaller and faster than XML. Protocol Buffers are widely used at Google for storing and interchanging all kinds of structured information. The method serves as a basis for a custom remote procedure call (RPC) system that is used for nearly all inter-machine communication at Google.


1 Answers

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

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.

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

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

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 >

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

HTH.

like image 106
Sergei Nikulov Avatar answered Sep 19 '22 17:09

Sergei Nikulov