• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天下

            記錄修行的印記

            Google Protocol Buffer 安裝和使用

            Google Protocol Buffer 安裝和使用
            下載:
            https://codeload.github.com/google/protobuf/

            看README.md

            For non-C++ users, the simplest way to install the protocol compiler is to
            download a pre-built binary from our release page:
            [https://github.com/google/protobuf/releases]


            下載C++的版本:
            https://github.com/google/protobuf/releases

            進入:protobuf-3.0.2\cmake 目錄
            用cmake 處理編譯

            編譯默認的代碼生成是MT,不是MD

            只需要2個工程:
            libprotobuf和protoc

            編譯完成之后:把include目錄拷貝出來

            新建SearchRequest.proto文件
            message SearchRequest 
            {
              required string query = 1;
              optional int32 page_number = 2;// Which page number do we want?
              optional int32 result_per_page = 3;// Number of results to return per page.
            }

            protoc.exe --cpp_out ./ SearchRequest.poto
            #include "stdafx.h"
            #include "SearchRequest.pb.h"

            //#pragma comment(lib,"../Debug/MT/libprotobufd.lib")
            #pragma comment(lib,"../Debug/MD/libprotobufd.lib")

            int _tmain(int argc, _TCHAR* argv[])
            {
                SearchRequest sr;

                sr.set_query("abcd",5);
                sr.set_page_number(0x1001);
                sr.set_result_per_page(0x1002);

                std::string data  = sr.SerializeAsString();

                SearchRequest sr2;

                sr2.ParseFromString(data);

                return 0;
            }

            posted on 2016-09-22 10:19 天下 閱讀(556) 評論(0)  編輯 收藏 引用 所屬分類: C/C++

            <2016年9月>
            28293031123
            45678910
            11121314151617
            18192021222324
            2526272829301
            2345678

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            97久久精品无码一区二区| 国产精品久久久久a影院| 久久夜色精品国产欧美乱| 999久久久免费精品国产| 国产一区二区精品久久岳| 欧美亚洲另类久久综合婷婷| 久久精品国产2020| 日本精品久久久久中文字幕| 久久强奷乱码老熟女网站| 午夜欧美精品久久久久久久| 久久精品国产精品青草app| 久久久午夜精品福利内容| 1000部精品久久久久久久久| 日本国产精品久久| 91久久成人免费| 色欲av伊人久久大香线蕉影院 | 久久久高清免费视频| 久久精品无码专区免费青青| 日日狠狠久久偷偷色综合免费| 99久久久精品免费观看国产| 久久婷婷五月综合成人D啪| 久久久久综合中文字幕 | 老色鬼久久亚洲AV综合| 精品久久久久久无码国产 | 久久久久久A亚洲欧洲AV冫| 久久亚洲欧美国产精品| 久久中文字幕人妻熟av女| 欧美一级久久久久久久大片| 久久99精品久久久久久9蜜桃| 久久久精品免费国产四虎| 精品久久久久久无码专区| 一本色道久久综合亚洲精品| 亚洲人成网站999久久久综合 | 久久婷婷五月综合成人D啪| 久久久人妻精品无码一区| 婷婷综合久久中文字幕| 久久精品免费观看| 亚洲AV无码久久精品成人| 亚洲精品白浆高清久久久久久| 亚洲日韩欧美一区久久久久我| 久久一区二区三区99|