Protobuf v3.3.0 under Windows compilation

Source: Internet
Author: User

One: Overview

About Protobuf No more here, the successful compilation steps are documented here for later review.
Note: This article is not compiled using the CMake GUI, and if you are familiar with the CMake GUI, you can also use the GUI to generate the compilation.

II: Preparation of resources and tools

    1. VS2013 or above, install well
    2. Protobuf Source code,:
      Official website: http://code.google.com/p/protobuf/
      git Web: https://github.com/google/protobuf
      or git:https://github.com/google/protobuf/releases
      Individual is the last address downloaded, the download package is at the end of: Source code (Zip) Full package
    3. CMake, download and install.
    4. Note: If you need to compile gtest, you will also need to download Gmock and gtest related resource packs from the officer network or GIT. (In the morning these two packages seem to be separate, now the new version, read the readme description, Gmock like has been integrated into the gtest). I do not need gtest, so do not download.

Three: Environment configuration

    1. After installing the CMake, open the cmd window and enter CMake--version to check if CMake is installed correctly. If you are prompted with an error, you will need to manually configure the CMake into the system environment variable
    2. Unzip the download good protobuf source full package. (If extracted to here: i:\dev\c++\, therefore, my PROTOBF resources are located at: i:\dev\c++\protobuf-3.3.0)

Four: Compiling protobuf

    1. Open the VS2013 x64 Local tool command Prompt (because the x64 version is compiled by the individual)
    2. CD I:\dev\c++\protobuf-3.3.0\cmake
    3. mkdir Build & CD Build
    4. mkdir Debug & CD Debug
      Tip: To compile release version, just mkdir release & CD release. This step simply creates a debug (or release) directory that holds the CMake file configuration information related to generating debug (or release). After performing steps 3 and 4, the current path is: i:\dev\c++\protobuf-3.3.0\cmake\build\release
    5. Cmake-g "NMake makefiles"-dcmake_build_type=release-dprotobuf_build_tests=off-dcmake_install_prefix=. /.. /.. /install. /..
      Wait a moment for the makefile-related configuration text to complete. If there are no prompt errors, continue with the next steps
    6. Nmake
      Wait a moment again for Protobuf (the corresponding debug or release version) to compile. If there are no prompt errors, continue with the next steps
    7. NMAKE Install
      Wait a moment again for the installation to complete. If there is no prompt error, an install directory will be generated in the i:\dev\c++\protobuf-3.3.0 directory with the bin directory, the Lib directory, the Include directory, and a cmake directory. Useful for development is primarily the first three directories.
    8. Tip: After the final generation of debug and release (if one is generated at the same time), then their include directory is exactly the same. Therefore, whether you are generating debug or release or both, you can do this in exactly the previous 7 steps.

Protobuf v3.3.0 under Windows compilation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.