1、建立靜态庫工程 :protobuf
2.(github上去下載下傳protobuf 2.5.0 [本人用的是2.5.0])在protobuf的源代碼根目錄中建立一個檔案夾xcodeproject
3.将剛剛建立的的工程關閉,并将工程剪切到建立的檔案夾内,并打開工程
删除protobuf.h和protobu.m
4.将下圖的google檔案夾拖到工程中
5.選項如下圖
6.删除complier檔案夾(選擇remove references)
7.将所有的unitest測試檔案删除掉(選擇remove references)
8.添加header search path
9.command+b進行編譯
報錯 config.h 無法找到
10.終端進入protobuf檔案夾
輸入指令
export CC=llvm-gcc; export CXX=llvm-g++; ./configure
并執行
執行完之後 會生成 config.h ,将config.h拖入工程 中,選 copy to
進入 xcode config.h 檔案中
1、将 檔案 中的 std::tr1 全部換成 std
2、将所有的 tr1 删除掉
11、編譯一下就成功了