锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久久九九99精品,久久激情亚洲精品无码?V,99久久精品国产一区二区http://www.shnenglu.com/colorful/category/19269.htmlzc qq:1337220912zh-cnMon, 19 Jan 2015 14:58:12 GMTMon, 19 Jan 2015 14:58:12 GMT60Quick-Cocos2d-x 闆嗘垚 Google protobuf 鏂規硶http://www.shnenglu.com/colorful/archive/2015/01/17/209557.html澶氬僵浜虹敓澶氬僵浜虹敓Sat, 17 Jan 2015 08:08:00 GMThttp://www.shnenglu.com/colorful/archive/2015/01/17/209557.htmlhttp://www.shnenglu.com/colorful/comments/209557.htmlhttp://www.shnenglu.com/colorful/archive/2015/01/17/209557.html#Feedback0http://www.shnenglu.com/colorful/comments/commentRss/209557.htmlhttp://www.shnenglu.com/colorful/services/trackbacks/209557.htmlhttp://cn.cocos2d-x.org/tutorial/show?id=506
鏈枃灝嗗悜鎮ㄤ粙緇峇uick-Cocos2d-x闆嗘垚google protobuf鐨勬柟娉曘? 
 
絎竴姝?  闇瑕佹渶鏂扮殑protobuf 綾誨簱鍜岃В鏋愮▼搴忋?nbsp;
涓嬭澆鍦板潃錛?a target="_blank">https://github.com/sean-lin/protoc-gen-lua
 
git clone https://github.com/sean-lin/protoc-gen-lua.git 鍒頒換鎰忕殑涓涓湴鏂?
 

鐒跺悗錛屽彲浠ュ緱鍒伴噸瑕佺殑涓や釜鐩綍

1
2
protoc-gen-lua/plugin/ 
protoc-gen-lua/protobuf/
 
絎簩姝ワ紝 闇瑕佷嬌鐢╬rotoc —lua_out=. 榪欑鏂規硶錛?灝嗘垜浠嚜宸辯殑*.proto 鐨勬枃浠惰В鏋愭垚lua鏂囦歡

plugin鐩綍鏄彁渚涘皢buffer 鏂囦歡瑙f瀽鎴恖ua 鐗堟湰鐨勭被搴擄紝 闇瑕乸ython 鏀寔銆? 濡傛灉宸茬粡緙栬瘧浜唃oogle 瀹樻柟鐨刾rotoc 閭d釜紼嬪簭錛?鍙渶瑕佸湪緋葷粺PATH鐜鍙橀噺鎬昏拷鍔爌lugin鐩綍灝卞ソ:

1
export PATH={protoc-gen-lua DIR }/plugin:$PATH
 
鍏充簬protoc鐨勭紪璇戝彟璇穏oogle .
 
濡傛灉瑙f瀽涓嶅嚭lua鏂囦歡鏉ワ紝 鍙互鎵嬪姩蹇椾俊涓涓媝lugin/protoc-gen-lua鐨勭▼搴忥紝 浠栧簲璇ユ槸+x 鐨勬潈闄?chmod +x plugin/protoc-gen-lua)
 
緇嗚妭鐨勫畨瑁呮楠ゅ彲浠ュ弬鑰?nbsp;https://code.google.com/p/protoc-gen-lua/
 
絎笁姝?錛?灝唒rotobuf 闆嗘垚鍒皅uick 涓?/strong>
protoc-gen-lua/protobuf/ 鐩綍灝辨槸瑕佺紪璇戝埌quick-cocos2d-x鐩綍閲岄潰鐨勯儴鍒嗐?nbsp;
 
鐜板湪錛?鎴戜滑鍙渶瑕?protoc-gen-lua/protobuf/pb.c 榪欎釜鏂囦歡 
 

鍏堢‘瀹氳嚜宸辯殑quick-cocos2d-x lua鎵╁睍鐩綍錛?

1
/quick-cocos2d-x/lib/cocos2d-x/scripting/lua/lua_extensions/
 
鎵鏈塴ua 鐨刢/c++鐜版垚鎵╁睍,閮藉彲浠ョ洿鎺ユ斁鍒拌繖閲屻?nbsp;
  
灝唒b.c榪欎釜鏂囦歡澶嶅埗鍒?lua_extension鐩綍涓嬶紝 鏈濂界嫭绔嬩竴涓洰褰曪紝 鍏嶅緱鎵╁睍澶氫簡涔便?nbsp;
  

榪欐槸鎴戠殑鐩綍緇撴瀯:

1
./quick-cocos2d-x/lib/cocos2d-x/scripting/lua/lua_extensions/protobuf/pb.c
  
鐒跺悗寮濮嬩慨鏀規墿灞曠▼搴忛厤緗枃浠? lua_extensions.c
 

璺緞涓猴細

1
./quick-cocos2d-x/lib/cocos2d-x/scripting/lua/lua_extensions/lua_extensions.c
 

鐩墠鏄竴涓笉瓚?0琛岀殑灝忔枃浠訛紝 鎴戞墦綆楀叏閮ㄨ創榪涙潵錛?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "lua_extensions.h" 
   
#if __cplusplus 
extern "C"
#endif 
    
// cjson 
#include "cjson/lua_cjson.h" 
    
    
// zlib 
#include "zlib/lua_zlib.h" 
    
    
// lpack 
#include "lpack/lpack.h" 
    
    
// socket 
#include "socket/luasocket.h" 
#include "socket/mime.h" 
#include "socket/socket_scripts.h" 
    
    
// filesystem 
#include "filesystem/lfs.h" 
    
    
// lsqlite3 
#include "lsqlite3/lsqlite3.h" 
    
    
#include "protobuf/pb.c"   //寮曠敤protobuf 搴撴枃浠?nbsp;
    
    
static luaL_Reg luax_exts[] = { 
     {"cjson", luaopen_cjson_safe}, 
     {"zlib", luaopen_zlib}, 
     {"pack", luaopen_pack}, 
     {"socket.core", luaopen_socket_core}, 
     {"mime.core", luaopen_mime_core}, 
     {"lfs", luaopen_lfs}, 
     {"lsqlite3", luaopen_lsqlite3}, 
     {NULL, NULL} 
}; 
    
    
void luaopen_lua_extensions(lua_State *L) 
     // load extensions 
     luaL_Reg* lib = luax_exts; 
     lua_getglobal(L, "package"); 
     lua_getfield(L, -1, "preload"); 
     for (; lib->func; lib++) 
     
         lua_pushcfunction(L, lib->func); 
         lua_setfield(L, -2, lib->name); 
     
     lua_pop(L, 2); 
    
    
     // load extensions script 
     luaopen_socket_scripts(L); 
     luaopen_pb(L);   //榪欐槸鍔犲叆鐨刾rotobuf 鎵╁睍娉ㄥ唽鍚?nbsp;
    
    
#if __cplusplus 
} // extern "C" 
#endif
鑷蟲 錛?protobuf 鎵╁睍閮ㄥ垎灝辯畻鎵╁睍瀹屾垚浜嗐?nbsp;
 
紜鏄惁鎴愬姛鏀寔 錛?鍙互鍦╭uick 欏圭洰鏈鍏堣璋冪敤鐨刲ua鏂囦歡涓拷鍔?require "pb" 鍋氭祴璇曘?nbsp;
 
*浣嗚繖鏃跺欓氳繃protoc 杞爜鍚庡緱鍒扮殑lua鏂囦歡榪樹笉鑳借瑙f瀽銆?nbsp;
 
絎洓姝?浠庨」鐩腑鍖呭惈protobuf鐨?lua搴?/strong>
protoc-gen-lua/protobuf/榪欎釜鐩綍涓嬮潰錛?榪樻湁澶ч噺鐨?lua鏂囦歡錛?鏄敤鏉ユ敮鎸乸roto杞爜鍚庣殑鏂囦歡瑙f瀽璋冪敤鐨勩?涓嶈兘灝戜簡榪欎簺鏂囦歡銆?nbsp;
 
澶嶅埗protoc-gen-lua/protobuf鏂囦歡澶?鍒伴」鐩腑 scripts鐩綍涓嬨? 
  

鐩綍緇撴瀯搴旇鏄繖鏍風殑錛?

1
[PROJECT]/scripts/protobuf/*.lua
 
鐒跺悗錛?闇瑕佸憡璇夋鏋訛紝浠庡摢閲屽彲浠ュ紩鐢ㄥ埌瀹冦?nbsp;
 

淇敼main.lua 鍦╮equire("appxxxxxx") 涓婇潰 錛?鍔犲叆涓嬮潰鐨勪唬鐮侊細

1
package.path = package.path .. ";./protobuf/?.lua;./scripts/protobuf/?.lua;"
 
榪欎釜鏂規硶錛?鑳戒繚璇佺▼搴忓湪琚紪璇戝埌鎵嬫満涔嬪悗浠嶇劧鍙互緇х畫璁塊棶榪欎釜搴撱?nbsp;
  
***鍗冧竾鍒妸杞爜鐨刾roto鏂囦歡鏀懼埌[PROJECT]/scripts/protobuf 鐩綍閲岄潰.涓嶄俊鍙互璇曡瘯銆?
 
鐜板湪錛?欏圭洰鏀寔protobuf 鏂囦歡鐨勮В鏋愪簡銆?
 
絎簲姝? 閲嶆柊緙栬瘧player-x
濡傛灉涓嶄範鎯敤player-x璋冭瘯錛?榪欎釜姝ラ涓嶆槸蹇呴』鐨勩?nbsp;
 

榪涘叆player-x qt婧愮爜鐩綍 錛?

1
cd quick-cocos2d-x/player/proj.qt
 

浣跨敤qmake 鏂囦歡鎵цquick-x.pro 鏂囦歡 

1
qmake ./quick-x.pro
 
緇х畫錛?
make 
 
絳夊緟緇撴潫錛?灝嗗緱鍒扮殑quick-x-player鏂囦歡錛?nbsp;
 
鏀懼埌錛歲uick-cocos2d-x/player/bin/mac/ 鐩綍涓嬶紝 榪欐牱sublime text 瑁匭uickXDev 鎵╁睍鐨勭洿鎺ュ彲浠ョ敤銆?nbsp;
  
**濡傛灉鏄痬ac os 10.9 緋葷粺錛?鍙兘緙栬瘧涓嶈繃鍘籶layer-x紼嬪簭銆?鎴戦亣鍒頒簡榪欎釜闂銆?nbsp;
 
浼氭彁紺洪敊璇? pb.c:28:10: fatal error: 'endian.h' file not found 
 

濡傛灉閿欒淇℃伅鐩稿悓錛?淇敼鏂囦歡:

1
./quick-cocos2d-x/lib/cocos2d-x/scripting/lua/lua_extensions/protobuf/pb.c
 

鏌ユ壘琛?

1
#include <endian.h>
  

涓存椂鍙樻洿涓猴細

1
#include <machine/endian.h>
  
鐒跺悗閲嶆柊緙栬瘧 player-x 
 
make 灝辮凍澶熶簡 
 
make
 
**player-x 緙栬瘧瀹屾瘯鍚庯紝 鍗冧竾瑕佸皢endian.h 寮曠敤鏀瑰洖鍘熸潵鐨?#include <endian.h> 錛?鍚﹀垯鎵撳寘鍒版墜鏈虹殑鏃跺欏張鍥炴彁紺烘枃浠舵壘涓嶅埌浜嗐?nbsp;


]]>
浣跨敤proto 鏃剁姱鐨勪竴涓敊璇?/title><link>http://www.shnenglu.com/colorful/archive/2012/05/22/175781.html</link><dc:creator>澶氬僵浜虹敓</dc:creator><author>澶氬僵浜虹敓</author><pubDate>Tue, 22 May 2012 10:00:00 GMT</pubDate><guid>http://www.shnenglu.com/colorful/archive/2012/05/22/175781.html</guid><wfw:comment>http://www.shnenglu.com/colorful/comments/175781.html</wfw:comment><comments>http://www.shnenglu.com/colorful/archive/2012/05/22/175781.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/colorful/comments/commentRss/175781.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/colorful/services/trackbacks/175781.html</trackback:ping><description><![CDATA[<div>鑷繁瀹氫箟鐨?#define CMD_ID_SERVER  1000<br /><br />鐒跺悗鍦╬roto鏂囦歡閲屽畾涔変簡 <br />enum CMD_ID<br />{<br />      CMD_ID_SERVER = 20000;<br />}<br /><br />寰楀埌涓嬮潰鐨勯敊璇?br /><div>Error    7    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    e:\zc\test\doloio\package\hello\hello.pb.h    46<br />Error    9    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    e:\zc\test\doloio\package\hello\hello.pb.h    46<br />Error    10    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    e:\zc\test\doloio\package\hello\hello.pb.h    47<br />Error    13    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    e:\zc\test\doloio\package\hello\hello.pb.h    47<br />Error    20    error C2447: '{' : missing function header (old-style formal list?)    e:\zc\test\doloio\package\hello\hello.pb.h    51<br />Error    27    error C2447: '{' : missing function header (old-style formal list?)    e:\zc\test\doloio\package\hello\hello.pb.h    431<br />Error    17    error C2440: 'initializing' : cannot convert from 'const int' to 'const std::string &'    e:\zc\test\doloio\package\hello\hello.pb.h    51<br />銆傘傘傘傘傘傘傘傘傘?/div><br />------------------------------------------<br />鍏跺疄鏍規嵁閿欒淇℃伅搴旇寰堝鏄撳彂鐜伴敊璇墍鍦紝浣嗗洜涓烘垜蹇冩ワ紝娌¤兘闈欎笅蹇冩潵鐪嬮敊璇俊鎭互鑷蟲氮璐逛簡鏇村鐨勬椂闂村拰綺懼姏浜庢棤璋撶殑鐚滄祴璇曢獙<br /><br /><br /></div><img src ="http://www.shnenglu.com/colorful/aggbug/175781.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/colorful/" target="_blank">澶氬僵浜虹敓</a> 2012-05-22 18:00 <a href="http://www.shnenglu.com/colorful/archive/2012/05/22/175781.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>linux涓嬪畨瑁卲rotobuf鏁欑▼+紺轟緥錛堣緇嗭級 http://www.shnenglu.com/colorful/archive/2012/05/05/173761.html澶氬僵浜虹敓澶氬僵浜虹敓Sat, 05 May 2012 10:17:00 GMThttp://www.shnenglu.com/colorful/archive/2012/05/05/173761.htmlhttp://www.shnenglu.com/colorful/comments/173761.htmlhttp://www.shnenglu.com/colorful/archive/2012/05/05/173761.html#Feedback2http://www.shnenglu.com/colorful/comments/commentRss/173761.htmlhttp://www.shnenglu.com/colorful/services/trackbacks/173761.html
1 鍦ㄧ綉绔?http://code.google.com/p/protobuf/downloads/list涓婂彲浠ヤ笅杞?Protobuf 鐨勬簮浠g爜銆傜劧鍚庤В鍘嬬紪璇戝畨瑁呬究鍙互浣跨敤瀹冧簡銆?/div>
瀹夎姝ラ濡備笅鎵紺猴細
 tar -xzf protobuf-2.1.0.tar.gz 
 cd protobuf-2.1.0 
 ./configure --prefix=/usr/local/protobuf
 make 
 make check 
 make install 
 
 2 > sudo vim /etc/profile
 娣誨姞
export PATH=$PATH:/usr/local/protobuf/bin/
export PKG_CONFIG_PATH=/usr/local/protobuf/lib/pkgconfig/
淇濆瓨鎵ц
source /etc/profile

鍚屾椂 鍦▇/.profile涓坊鍔犱笂闈袱琛屼唬鐮侊紝鍚﹀垯浼氬嚭鐜扮櫥褰曠敤鎴鋒壘涓嶅埌protoc鍛戒護

3 > 閰嶇疆鍔ㄦ侀摼鎺ュ簱璺緞
sudo vim /etc/ld.so.conf
鎻掑叆錛?/div>
/usr/local/protobuf/lib

4 > su  #root 鏉冮檺
ldconfig

5> 鍐欐秷鎭枃浠訛細msg.proto
  1. package lm;   
  2. message helloworld   
  3. {   
  4.     required int32     id = 1;  // ID     
  5.     required string    str = 2;  // str    
  6.     optional int32     opt = 3;  //optional field   
  7. }  
灝嗘秷鎭枃浠秏sg.proto鏄犲皠鎴恈pp鏂囦歡
protoc -I=. --cpp_out=. msg.proto
鍙互鐪嬪埌鐢熸垚浜?/div>
msg.pb.h 鍜宮sg.pb.cc

6> 鍐欏簭鍒楀寲娑堟伅鐨勮繘紼?/div>
write.cc
  1. #include "msg.pb.h"  
  2. #include <fstream>  
  3. #include <iostream>  
  4. using namespace std;  
  5.   
  6. int main(void)   
  7. {   
  8.   
  9.     lm::helloworld msg1;   
  10.     msg1.set_id(101);   
  11.     msg1.set_str("hello");   
  12.     fstream output("./log", ios::out | ios::trunc | ios::binary);   
  13.   
  14.     if (!msg1.SerializeToOstream(&output)) {   
  15.         cerr << "Failed to write msg." << endl;   
  16.         return -1;   
  17.     }          
  18.     return 0;   
  19. }  
緙栬瘧 write.cc 
 g++  msg.pb.cc write.cc -o write  `pkg-config --cflags --libs protobuf` -lpthread
 
鎵цwrite 
./write錛?鍙互鐪嬪埌鐢熸垚浜唋og鏂囦歡

7> 鍐欏弽搴忓垪鍖栫殑榪涚▼
reader.cc
  1. #include "msg.pb.h"  
  2. #include <fstream>  
  3. #include <iostream>  
  4. using namespace std;  
  5.   
  6. void ListMsg(const lm::helloworld & msg) {    
  7.     cout << msg.id() << endl;   
  8.     cout << msg.str() << endl;   
  9. }   
  10.   
  11. int main(int argc, char* argv[]) {   
  12.   
  13.     lm::helloworld msg1;   
  14.   
  15.     {   
  16.         fstream input("./log", ios::in | ios::binary);   
  17.         if (!msg1.ParseFromIstream(&input)) {   
  18.             cerr << "Failed to parse address book." << endl;   
  19.             return -1;   
  20.         }         
  21.     }   
  22.   
  23.     ListMsg(msg1);   
  24. }  
緙栬瘧錛歡++  msg.pb.cc reader.cc -o reader  `pkg-config --cflags --libs protobuf` -lpthread
鎵ц./reader 杈撳嚭 錛?/div>
101
hello

8> 鍐橫akefile鏂囦歡
  1. all: write reader  
  2.   
  3. clean:  
  4.     rm -f write reader msg.*.cc msg.*.h *.o  log  
  5.   
  6. proto_msg:  
  7.     protoc --cpp_out=. msg.proto  
  8.   
  9.   
  10. write: msg.pb.cc write.cc  
  11.     g++  msg.pb.cc write.cc -o write  `pkg-config --cflags --libs protobuf`  
  12.   
  13. reader: msg.pb.cc reader.cc  
  14.     g++  msg.pb.cc reader.cc -o reader  `pkg-config --cflags --libs protobuf` 


]]>protobuf瀹夎鍚庡嚭鐜發ibprotobuf.so.6 not found after installationhttp://www.shnenglu.com/colorful/archive/2012/05/05/173739.html澶氬僵浜虹敓澶氬僵浜虹敓Sat, 05 May 2012 06:41:00 GMThttp://www.shnenglu.com/colorful/archive/2012/05/05/173739.htmlhttp://www.shnenglu.com/colorful/comments/173739.htmlhttp://www.shnenglu.com/colorful/archive/2012/05/05/173739.html#Feedback0http://www.shnenglu.com/colorful/comments/commentRss/173739.htmlhttp://www.shnenglu.com/colorful/services/trackbacks/173739.htmlPlease follow the instructions in README.txt:

** Hint on install location **

  By default, the package will be installed to /usr/local.  However,
  on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH.
  You can add it, but it may be easier to just install to /usr
  instead.  To do this, invoke configure as follows:

    ./configure --prefix=/usr

  If you already built the package with a different prefix, make sure
  to run "make clean" before building again.

** 緲昏瘧 translate **

  榛樿鎯呭喌涓嬶紝鍖呬細琚畨瑁呭湪/usr/local璺緞涓嬨備絾鏄紝鍦ㄦ煇浜涚郴緇熷鉤鍙頒笂(濡俇buntu 11)錛?usr/local/lib璺緞騫朵笉鍖呭惈鍦↙D_LIBRARY_PATH涓備綘鍙互鎵嬪姩娣誨姞錛屼絾涔熷彲浠ュ緢鏂逛究鐨勯氳繃瀹夎鍒?usr璺緞涓嬶紝璋?鐢╟onfigure鍛戒護鍙傛暟濡備笅

    ./configure --prefix=/usr

  濡傛灉浣犵殑鍖呭凡緇忕紪璇戣繃錛岀‘淇濆厛榪愯"make clean"鍐嶉噸鏂扮紪璇戙?

reference:http://code.google.com/p/protobuf/issues/detail?id=213


]]>ubuntu瀹夎protobufhttp://www.shnenglu.com/colorful/archive/2012/05/05/173738.html澶氬僵浜虹敓澶氬僵浜虹敓Sat, 05 May 2012 06:35:00 GMThttp://www.shnenglu.com/colorful/archive/2012/05/05/173738.htmlhttp://www.shnenglu.com/colorful/comments/173738.htmlhttp://www.shnenglu.com/colorful/archive/2012/05/05/173738.html#Feedback0http://www.shnenglu.com/colorful/comments/commentRss/173738.htmlhttp://www.shnenglu.com/colorful/services/trackbacks/173738.html
  • 1.涓嬭澆http://code.google.com/p/protobuf/downloads/list
  • 2.瑙e帇
  • Shell浠g爜  鏀惰棌浠g爜
    1. tar jxvf protobuf-2.4.1.tar.bz2 protobuf  
  • 3.緙栬瘧
  • Shell浠g爜  鏀惰棌浠g爜
    1. $ ./configure  
    2. $ make  
    3. $ make install  
       
  • 4.浣跨敤
  • Shell浠g爜  鏀惰棌浠g爜
    1. /usr/bin/protoc /home/jiangrongyong/work/proto/*.proto --proto_path=/home/jiangrongyong/work/proto --java_out=/home/jiangrongyong/work/proto-output  


    protobuf瀹夎鍚庡嚭鐜發ibprotobuf.so.6 not found after installation
    http://yuu1987.iteye.com/blog/1240712
    鍒嗕韓鍒幫細


    ]]>ProtocolBuffers2.4.1搴旂敤璇存槑(涓)http://www.shnenglu.com/colorful/archive/2012/03/02/167012.html澶氬僵浜虹敓澶氬僵浜虹敓Fri, 02 Mar 2012 14:04:00 GMThttp://www.shnenglu.com/colorful/archive/2012/03/02/167012.htmlhttp://www.shnenglu.com/colorful/comments/167012.htmlhttp://www.shnenglu.com/colorful/archive/2012/03/02/167012.html#Feedback0http://www.shnenglu.com/colorful/comments/commentRss/167012.htmlhttp://www.shnenglu.com/colorful/services/trackbacks/167012.htmlProtocolBuffers2.4.1搴旂敤璇存槑(涓)
    2012-02-03 12:07

     

    瀹㈡柟鐨凱rotocolBuffers 璇︾粏璇存槑錛屽彲浠ヤ笅杞芥渶鏂扮増鐨凱rotocolBuffers鍖呫?/p>

    鎴戞墍涓嬭澆鐨勫寘鏄細protobuf-2.4.1.tar.bz2 銆?nbsp;protoc-2.4.1-win32.zip

     

    ProtocolBuffers 棣栭〉錛?a >http://code.google.com/intl/zh-CN/apis/protocolbuffers/docs/overview.html

    protobuf-2.4.1.tar.bz2  鏄簮鐮佸寘

     protoc-2.4.1-win32.zip 鏄紪璇?.proto 鏂囦歡鐨勭紪璇戝櫒

    鏈枃浣跨敤 ProtocolBuffers 鐨勭幆澧?/p>

    鎿嶄綔緋葷粺錛?windows 7 64浣?/p>

    寮鍙戝伐鍏鳳細Visual studio 2008

    寮鍙戣璦錛欳++銆丮FC綾誨簱

    絎竴姝ワ細 緙栬瘧protobuf-2.4.1宸ョ▼

    璇存槑錛氱紪璇憄rotobuf-2.4.1宸ョ▼鍚庣敓鎴?libprotobuf.lib, libprotobuf.lib 浼氬湪鑷凡鐨勫伐紼嬫枃浠朵腑鐢ㄥ埌榪欎釜搴撴枃浠?/p>

    1錛夊綋鍓嶇殑鐩綍緇撴瀯涓猴細

    E:\ProtocolBuffers\ 姝ょ洰褰曠粨鏋勪笅鏈変袱涓寘 protobuf-2.4.1.tar.bz2 銆乸rotoc-2.4.1-win32.zip

    2錛夎В鍘?protobuf-2.4.1.tar.bz2 鍖?/p>

    浼氱敓 E:\ProtocolBuffers\protobuf-2.4.1\protobuf-2.4.1鐩綍緇撴瀯

    璋冩暣鍚庣殑鐩綍緇撴瀯涓猴細E:\ProtocolBuffers\protobuf-2.4.1鐩綍緇撴瀯錛屼究浜庡簲鐢ㄣ?/p>

    3錛塚S2008緙栬瘧宸ョ▼

    鎵懼埌 E:\ProtocolBuffers\protobuf-2.4.1\vsprojects\protobuf.sln鏂囦歡銆?/p>

    鐢╒S2008 鎵撳紑錛岀劧鍚庣紪璇戞暣涓姛紼嬶紝寰堥『鍒╃殑緙栬瘧瀹屾暣涓姛紼嬨?/p>

    濡傚浘鎵紺猴細

        

    緙栬瘧瀹屾垚鍚庝細鍦‥:\ProtocolBuffers\protobuf-2.4.1\vsprojects\Debug 鐩綍緇撴瀯涓敓鎴恖ibprotobuf.lib搴撴枃浠躲?/p>

    4) 濡傛灉鍑虹幇闂錛?/p>

    鍙互闃呰 vsprojects\readme.txt 璇存槑鏂囨。銆?nbsp; 

     

    絎簩姝ワ細緙栧啓 .proto 鏂囦歡

     

    1錛?span>鍦ㄧ洰褰?E:\ProtocolBuffers\protobuf-2.4.1\examples 涓湁涓ず渚?/p>

    鍙互鍏堟寜瀹樻柟鐨勬枃妗f潵鐔熸倝涓涓嬨?/p>

    2錛?緙栧啓 .proto 鏂囦歡

    鑷凡緙栧啓鐨?shapeobject.proto 鏂囦歡

     

    package candee;

    option java_package = "com.example.candee";

    option java_outer_classname = "ShapeObjectProto";

    message DrawInfoPB {


    message ColorVal {

    required int32r = 1;//int32  unsigned short

    required int32g = 2;

    required int32b = 3;

    }

     

    required int32toolbarState = 1;// TOOLBAR_STATE

    required ColorValpenColor = 2;// 絎旂殑棰滆壊

    required int32penLineWidth = 3;// 鐢ㄦ埛璁劇疆鐢葷瑪鐨勫搴?/span>

    required ColorValwordColor = 4;// 瀛楃殑棰滆壊

    required int32wordLineWidth = 5;// 鐢ㄦ埛璁劇疆瀛楃殑瀹藉害

    required ColorValgraphColor = 6;// 鍥懼艦鐨勯鑹?/span>

    required int32graph = 7;// 鍥懼艦

    required int32graphLineWidth = 8;// 緇樺埗鍥懼艦鐨勭嚎瀹?/span>

    }

     

    message ShapeObjectPB {

     

    required DrawInfoPB drawInfoPB = 1;// 緇樼敾淇℃伅

     

    message DrawPointPB {

    required int32 x1 = 1;

    required int32 y1 = 2;

    required int32 X2 = 3;

    required int32 y2 = 4;

    }

    repeated DrawPointPB drawPointPB = 2;// 緇樼敾鍧愭爣

     

    optional string textPB = 3;// 緙栬緫妗嗘枃瀛椾俊鎭?/span>

    }

     

    message DataPB {

    repeated ShapeObjectPB shapeObjectPB = 1;

    }


    絎笁姝?緙栬瘧 shapeobject.proto 鏂囦歡錛岀敓鎴怌++婧愭枃浠?/span>

     

    1錛夎В鍘?E:\ProtocolBuffers\protoc-2.4.1-win32.zip

       浼氱敓鎴?E:\ProtocolBuffers\protoc-2.4.1-win32\protoc.exe 緙栬瘧鏂囦歡銆?/p>

    2) 灝?protoc.exe 鑰冭礉鍒?shapeobject.proto鏂囦歡鍚屼竴綰х洰褰曚腑銆?/p>

    鏈洰褰曚負 E:\ProtocolBuffers\protobuf-2.4.1\examples

    3錛夊懡浠ゆ墽琛宲rotoc 鏂囦歡

    鍦╘examples\ 鏂板緩涓涓洰褰曚負 1\鐢ㄦ潵淇濆瓨鐢熸垚鐨凜++婧愭枃浠?/p>

    鍦ㄥ懡浠よ涓嬶紝鎵цprotoc --cpp_out=1 shapeobject.proto

    濡傚浘鎵紺猴細

     4錛夌敓鎴愮殑C++婧愭枃浠?/p>

    鍦‥:\ProtocolBuffers\protobuf-2.4.1\examples\1 鐩綍涓繚瀛樼敓鎴愮殑鏂囦歡

    鐢熸垚鐨勬枃浠訛細shapeobject.pb.cc shapeobject.pb.h

    灝嗚繖涓や釜鏂囦歡娣誨姞鍒頒綘鐨勫姛紼嬩腑錛屽氨鍙互鐢ㄦ埛ProtocolBuffer浜?/p>



    ]]> 奇米影视7777久久精品人人爽| 九九精品99久久久香蕉| 久久国产精品二国产精品| 久久婷婷五月综合成人D啪 | 久久电影网2021| 国产2021久久精品| 99久久精品国产一区二区| 久久精品国产99国产电影网| 久久国产亚洲精品| 国产一区二区精品久久| 午夜精品久久久久久| 久久婷婷综合中文字幕| 伊人久久大香线蕉AV一区二区| 精品久久久久久国产| 狠狠色丁香久久婷婷综合蜜芽五月| 91精品国产91久久久久福利| 亚洲七七久久精品中文国产| 国产69精品久久久久99尤物| 亚洲欧美日韩久久精品第一区| 久久久久人妻一区精品| 久久久久久午夜精品| 99久久精品国产高清一区二区| 伊人情人综合成人久久网小说| 久久er国产精品免费观看2| 国内精品久久久久影院老司| 久久久精品久久久久特色影视| 东京热TOKYO综合久久精品| 久久精品国产久精国产果冻传媒| 国产精品亚洲美女久久久| 久久99国产精品久久| 99精品久久精品| 国产精品无码久久综合| 国产产无码乱码精品久久鸭| 国产亚洲美女精品久久久2020| 一级做a爰片久久毛片免费陪| 久久久WWW免费人成精品| 99久久精品无码一区二区毛片 | yy6080久久| 国产精品久久久久久久app| 久久久久久久综合综合狠狠| 亚洲欧美日韩精品久久|