gpt4 book ai didi

c++ - Apple Mach-O 链接器错误 : Undefined symbols for architecture armv7 Google Protobuf

转载 作者:行者123 更新时间:2023-11-30 04:04:05 25 4
gpt4 key购买 nike

我一直在做一个包含两部分的项目:

  1. Cocoa Touch 静态库 (.framework)
  2. 使用我的 (.framework) 静态库的演示应用程序

我了解到,添加到我的 .framework(即 opencv2.framework)中的任何 .framework 也必须添加到我的演示应用程序中。我还了解到,Build Settings for Architectures 必须相同,并且必须设置 Build Settings Search Paths

很高兴,我已经在我的演示应用程序中构建和使用我的 .framework 很长一段时间了。最近,我将 Google Protocol Buffers 添加到我的 .framework 中。

  1. 我的 .framework 正在编译,在 .framework 中似乎一切正常。
  2. 当然,我的 Demo 应用程序不是很满意。

现在我已经将 libprotobuf-lite.a 添加到我的演示应用程序中,并在 Header Search Paths 中添加了 Header 文件的路径。

这应该可以解决问题。但是,相反,我收到以下错误,到目前为止还没有找到答案。这是错误日志:

Undefined symbols for architecture armv7:
"vtable for google_public::protobuf::Message", referenced from:
google_public::protobuf::Message::Message() in Test-Remote-iOS-Aggregate(ftype.pb.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"typeinfo for google_public::protobuf::Message", referenced from:
typeinfo for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
message::FtypeMessage const* google_public::protobuf::internal::dynamic_cast_if_available<message::FtypeMessage const*, google_public::protobuf::Message const*>(google_public::protobuf::Message const*) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::GetTypeName() const", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::InitializationErrorString() const", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::SpaceUsed() const", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::ReflectionOps::Merge(google_public::protobuf::Message const&, google_public::protobuf::Message*)", referenced from:
message::FtypeMessage::MergeFrom(google_public::protobuf::Message const&) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::VerifyUTF8StringFallback(char const*, int, google_public::protobuf::internal::WireFormat::Operation)", referenced from:
google_public::protobuf::internal::WireFormat::VerifyUTF8String(char const*, int, google_public::protobuf::internal::WireFormat::Operation) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"_OBJC_CLASS_$_CVImageConverter", referenced from:
objc-class-ref in Test-Remote-iOS-Aggregate(IDMessageCommand.o)
"google_public::protobuf::UnknownFieldSet::ClearFallback()", referenced from:
google_public::protobuf::UnknownFieldSet::Clear() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::DiscardUnknownFields()", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(google_public::protobuf::UnknownFieldSet const&)", referenced from:
message::FtypeMessage::ByteSize() const in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::SerializeUnknownFields(google_public::protobuf::UnknownFieldSet const&, google_public::protobuf::io::CodedOutputStream*)", referenced from:
message::FtypeMessage::SerializeWithCachedSizes(google_public::protobuf::io::CodedOutputStream*) const in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))", referenced from:
message::protobuf_AddDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::SkipField(google_public::protobuf::io::CodedInputStream*, unsigned int, google_public::protobuf::UnknownFieldSet*)", referenced from:
message::FtypeMessage::MergePartialFromCodedStream(google_public::protobuf::io::CodedInputStream*) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::UnknownFieldSet::MergeFrom(google_public::protobuf::UnknownFieldSet const&)", referenced from:
message::FtypeMessage::MergeFrom(message::FtypeMessage const&) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google_public::protobuf::Descriptor const*, google_public::protobuf::Message const*, int const*, int, int, int, google_public::protobuf::DescriptorPool const*, google_public::protobuf::MessageFactory*, int)", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::~Message()", referenced from:
message::FtypeMessage::FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
message::FtypeMessage::~FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::UnknownFieldSet::UnknownFieldSet()", referenced from:
message::FtypeMessage::FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::CheckTypeAndMergeFrom(google_public::protobuf::MessageLite const&)", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::DescriptorPool::generated_pool()", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int)", referenced from:
message::protobuf_AddDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::SerializeToOstream(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const", referenced from:
message::TestMessaging::ftypeMessage(void const*, unsigned long) in Test-Remote-iOS-Aggregate(TestMessaging.o)
"google_public::protobuf::MessageFactory::InternalRegisterGeneratedMessage(google_public::protobuf::Descriptor const*, google_public::protobuf::Message const*)", referenced from:
message::(anonymous namespace)::protobuf_RegisterTypes(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(google_public::protobuf::UnknownFieldSet const&, unsigned char*)", referenced from:
message::FtypeMessage::SerializeWithCachedSizesToArray(unsigned char*) const in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::DescriptorPool::FindFileByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::MessageFactory::generated_factory()", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::UnknownFieldSet::~UnknownFieldSet()", referenced from:
message::FtypeMessage::FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
message::FtypeMessage::~FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

关于这里可能出现的问题有什么想法吗?

谢谢。

最佳答案

看起来链接器没有在您的 .framework 上运行,并且 .proto 文件是为完整的 libprotobuf 而不是 libprotobuf-lite 而构建的

尝试将胖 libprotobuf.a 添加到应用程序的框架文件夹中,看看它是否找到符号。

作为旁注,您还没有提到另一个错误:“_OBJC_CLASS_$_CVImageConverter”,引用自:
Test-Remote-iOS-Aggregate(IDMessageCommand.o) 中的 objc-class-ref

不知道如何在没有看到您的代码的情况下解决这个问题。

关于c++ - Apple Mach-O 链接器错误 : Undefined symbols for architecture armv7 Google Protobuf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23939382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com