1

我正在尝试从目标文件创建一个可执行文件。这是我使用过的命令 -

g++ -Wall -O3 -std=c++0x -march=native -fopenmp -pthread -I/usr/local/include -DUSESSE -DUSEOMP -c -o timer.o timer.cpp
g++  model.pb.cc -Wall -O3 -std=c++0x -march=native -fopenmp -pthread -I/usr/local/include -DUSESSE -DUSEOMP  `pkg-config --cflags --libs protobuf` -c -o ffm-model.o
g++ -c ffm.cpp -Wall -O3 -std=c++0x -march=native -fopenmp -pthread -I/usr/local/include -DUSESSE -DUSEOMP -pthread -L/usr/local/lib -lprotobuf -lpthread -I. -o ffm.o 
g++ -Wall -O3 -std=c++0x -march=native -fopenmp -pthread -I/usr/local/include -DUSESSE -DUSEOMP -pthread -I/usr/local/include  -pthread -L/usr/local/lib -lprotobuf -lpthread -o ffm-train ffm-train.cpp ffm.o timer.o ffm-model.o

但我收到错误 -

ffm.o: 在函数ffm::ffm_save_model(ffm::ffm_model&, std::string)': ffm.cpp:(.text+0x38b9): undefined reference to google::protobuf::Message::SerializeToOstream(std::ostream*) const' ffm.o: 在函数 google::protobuf::RepeatedField<int>::Reserve(int)': ffm.cpp:(.text._ZN6google8protobuf13RepeatedFieldIiE7ReserveEi[_ZN6google8protobuf13RepeatedFieldIiE7ReserveEi]+0x67): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAligned(unsigned long)' ffm .cpp:(.text._ZN6google8protobuf13RepeatedFieldIiE7ReserveEi[_ZN6google8protobuf13RepeatedFieldIiE7ReserveEi]+0xfa): 未定义引用 google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const' ffm-model.o: In function protobuf_model_2eproto::InitDefaultsFFMmodelImpl()': model.pb.cc:(.text+0x1d): 未定义引用 google::protobuf::internal::VerifyVersion(int, int, char const*)' model.pb.cc:(.text+0x22): undefined reference to google::protobuf::internal: :InitProtobufDefaults()' model.pb.cc:(.text+0x57): 未定义引用 google::protobuf::internal::OnShutdownDestroyMessage(void const*)' ffm-model.o: In function protobuf_model_2eproto::protobuf_AssignDescriptors()': model.pb.cc:(.text+0x107): 未定义引用 google::protobuf::internal::AssignDescriptors(std::string const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)' ffm-model.o: In function protobuf_model_2eproto::protobuf_RegisterTypes(std::string const&)': model.pb.cc:(.text+0x188): 未定义对 google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)' ffm-model.o: In function protobuf_model_2eproto::AddDescriptorsImpl()'的引用: model.pb.cc:(.text+0x1a2):未定义对 google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int)' model.pb.cc:(.text+0x1b1): undefined reference to google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void ( )(std::string const&))' ffm-model.o 的引用:在函数 FFMmodel::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': model.pb.cc:(.text+0x7a6): undefined reference to google::protobuf::io::CodedInputStream:: ReadTagFallback(unsigned int)' model.pb.cc:(.text+0x9db): 未定义对 google::protobuf::internal::WireFormat::SkipField(google::protobuf::io::CodedInputStream*, unsigned int, google::protobuf::UnknownFieldSet*)' ffm-model.o: In function FFMmodel::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream ) 的引用 const': model.pb.cc:(.text +0xa40): 未定义的引用 google::protobuf::internal::WireFormatLite::WriteInt32(int, int, google::protobuf::io::CodedOutputStream*)' model.pb.cc:(.text+0xa71): undefined reference to google::protobuf::internal::WireFormatLite::WriteInt32(int, int, google::protobuf::io::CodedOutputStream*)' model.pb.cc:(.text+0xaa2): undefined reference to google::protobuf::internal::WireFormatLite::WriteInt32(int, int, google::protobuf::io::CodedOutputStream*)' model.pb.cc:(.text+0xad1): undefined reference to google:: protobuf::internal::WireFormatLite::WriteBool(int, bool, google::protobuf::io::CodedOutputStream*)' model.pb.cc:(.text+0xc02): 对 google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet const&, google::protobuf::io::CodedOutputStream*)' ffm-model.o: In functionFFMmodel::InternalSerializeWithCachedSizesToArray(bool ) 的未定义引用, unsigned char*) const': model.pb.cc:(.text+0xe01): 未定义对 google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*)' ffm-model.o: In function FFMmodel::ByteSizeLong() 的引用 const': model.pb.cc:(.text+0xec5): 未定义对 google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(google::protobuf::UnknownFieldSet const&)' model.pb.cc:(.text+0xed9): undefined reference to google的引用::protobuf::internal::WireFormatLite::Int32Size(google::protobuf::RepeatedField const&)' ffm-model.o: 在函数中 FFMmodel::MergeFrom(google::protobuf::Message const&)': model.pb.cc:(.text+0x101f): undefined reference to google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)' model.pb.cc:(.text+0x1035): 未定义对 google::protobuf::internal::LogMessage::operator<<(char const*)' model.pb.cc:(.text+0x104d): undefined reference to google::protobuf 的引用: :internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)' model.pb.cc:(.text+0x1061): undefined reference to google::protobuf::internal::LogMessage::~LogMessage()' model.pb.cc:(.text+0x108e): undefined reference to google::protobuf::internal::ReflectionOps::合并(google::protobuf::Message const&, google::protobuf::Message*)' model.pb.cc:(.text+0x10bc): 未定义对 `google::protobuf::internal::LogMessage:: 的引用~LogMessage()'

知道我做错了什么吗?

4

0 回答 0