C++ Protobuffer 2.6与gcc 4.8(macports)的链接错误
我已经通过macports和GCC4.8安装了Google protobuffers的2.6版,当我编译代码(使用-lprotobuf标志)时,得到以下链接错误:C++ Protobuffer 2.6与gcc 4.8(macports)的链接错误,c++,linker,protocol-buffers,C++,Linker,Protocol Buffers,我已经通过macports和GCC4.8安装了Google protobuffers的2.6版,当我编译代码(使用-lprotobuf标志)时,得到以下链接错误: Undefined symbols for architecture x86_64: "google::protobuf::MessageLite::ParseFromString(std::basic_string<char, std::char_traits<char>, std::allocator<
Undefined symbols for architecture x86_64:
"google::protobuf::MessageLite::ParseFromString(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
_main in cclSIxVT.o
"google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))", referenced from:
protomessages::protobuf_AddDesc_msg_2eproto() in cc219IO6.o
"google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*)", referenced from:
protomessages::DatabaseRequestInfo::SerializeWithCachedSizesToArray(unsigned char*) const in cc219IO6.o
"google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)", referenced from:
protomessages::DatabaseRequestInfo::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in cc219IO6.o
"google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)", referenced from:
protomessages::DatabaseRequestInfo::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*) in cc219IO6.o
"google::protobuf::DescriptorPool::FindFileByName(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
protomessages::protobuf_AssignDesc_msg_2eproto() in cc219IO6.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
我已经检查过库是否编译为64位
Non-fat file: /opt/local/lib/libprotobuf.a is architecture: x86_64
你知道我哪里出错了吗?如果你需要关于链接失败的帮助,你至少需要发布链接失败的命令,而不仅仅是它的效果。你的protobuf库是64位的?是的。它是使用macports安装的。(请参见上面的确认)您的问题似乎是重复的。如果是这样的话,你可以自己关闭它。不,不是这样,我正在使用gcc 4.8。很遗憾:(如果你需要帮助解决链接失败的问题,你需要发布至少失败的link命令,而不仅仅是它的效果。你的protobuf库是64位的?是的。它是使用macports安装的。(请参见上文确认)似乎您的问题是的重复。如果是这样,您可以自己关闭它。不,不是,我正在使用gcc 4.8:(
Non-fat file: /opt/local/lib/libprotobuf.a is architecture: x86_64