2017-01-23 57 views
0

我想在XCode8中使用一些現有的使用Google Protobuf的C++代碼構建IOS應用,但無法使其工作。在XCode8中使用C++ Protobuf IOS應用

我嘗試使用CocoaPods,如here和其他地方所述。

還嘗試了一些建築腳本:script1,script2

在所有的嘗試我最終得到的:

Undefined symbols for architecture arm64: 
    "google_public::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google_public::protobuf::io::CodedOutputStream*)", 
    "google_public::protobuf::internal::WireFormat::VerifyUTF8StringFallback(char const*, int, google_public::protobuf::internal::WireFormat::Operation, char const*)", 
    "google_public::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char*)", 

隨着那些缺少一些更多的protobuf實現功能的列表。

是否有任何其他方式來編譯/使用protobuf庫Xcode的IOS應用程序?

+0

由於問題中的函數都是使用'std :: string'的函數,因此我想知道這是否與以下內容有關:http://stackoverflow.com/questions/30124264/undefined-reference-to-googleprotobufinternalempty-string -abicxx11/30175210 –

回答

0

解決:我有多個版本的protobuf在我的系統上從所有的嘗試,我意外地混合不同版本的包括,lib和protoc生成的文件。

0

如果要集成C++代碼,則必須將C++代碼的文件從.cpp更改爲.mm。你做過了嗎?

+0

當然。 C++代碼編譯並運行良好,直到Protobuf的使用。 – Oren