简体   繁体   中英

Use C++ Protobuf in XCode8 IOS app

I'm trying to build an IOS app in XCode8 with some existing C++ code that uses Google Protobuf, but can't get it to work.

I tried using CocoaPods as described here and in other places.

Also tried some building scripts: script1 , script2 .

In all of the tries I eventually got:

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*)",

With a list of some more protobuf implementation functions that are missing.

Is there any other way to compile/use the protobuf library XCode for IOS app?

If you want to integrate C++ code you have to change the file ending for the C++ code from .cpp to .mm. Have you done this?

解决:在所有尝试中,我的系统上都有多个版本的protobuf,并且我意外地将include,lib和protoc生成的文件的不同版本混合在一起。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM