Install Protocol Buffers on Windows

前端 未结 8 1138
渐次进展
渐次进展 2021-02-01 14:18

I am unable to find clear instructions to install Google Protocol Buffers (including compiler) on Windows x64 platform.

I went through the instructions README file for c

相关标签:
8条回答
  • 2021-02-01 15:20

    Download protoc-2.5.0-win32.zip from

    https://github.com/protocolbuffers/protobuf/releases/tag/v2.5.0

    Then to install, simply place this binary somewhere in your PATH

    0 讨论(0)
  • 2021-02-01 15:21

    I was build protobuf v2.4.1 on Windows 10 as follows:

    • git clone https://github.com/protocolbuffers/protobuf.git;
    • cd protobuf;
    • git checkout v2.4.1;
    • cd vsprojects
    • open protobuf.sln in Visual Studio 2019
    • Press build solution and take many errors: min undefined and max undefined Add in file protobuf/stubs/common.h next code:
    #if defined(_WIN32) && !defined(min)
    #define min(a,b) __min(a,b)
    #define max(a,b) __max(a,b)
    #endif
    
    • Press build solution and take error: fatal error C1189: “#error: hash_map is deprecated and will be REMOVED….
    • Add compile definition -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS solved problem
    • Next I had error “error C2664: "std::pair std::make_pair(_Ty1 &&,_Ty2 &&) noexcept”…
    • In file src\google\protobuf\compiler\command_line_interface.cc I modified string “proto_path_.push_back(make_pair< string, string >(virtual_path, disk_path));” to “proto_path_.push_back(make_pair(virtual_path, disk_path));
    • Press build solution. All build succeed.(Tests projects not build without test framework)

      INSTALL:

    • Run extract_includes.bat to copy all the public headers into a separate "include" directory (under the top-level package directory).
    • Copy the contents of the include directory to wherever you want to put headers
    • Copy protoc.exe wherever you put build tools
    • copy libprotobuf.lib, libprotobuf-lite.lib, and libprotoc.lib wherever you put libraries.
    0 讨论(0)
提交回复
热议问题