我正在尝试从目标文件创建可执行文件。 以下是我使用过的命令 -
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
谷歌:: protobuf的::内部:: ArenaImpl :: AllocateAligned(无符号 长)' 。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
谷歌:: protobuf的::内部:: 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&amp;)': 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
谷歌:: protobuf的::的MessageFactory :: InternalRegisterGeneratedFile(炭 const *,void()(std :: string const&amp;))'ffm-model.o:在函数中FFMmodel::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)': model.pb.cc:(.text+0x7a6): undefined reference to
谷歌:: protobuf的:: IO :: CodedInputStream :: ReadTagFallback(无符号 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(谷歌:: protobuf的:: IO :: CodedOutputStream ) const':model.pb.cc :(。text + 0xx40):未定义的引用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): 未定义的引用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 + 0xx02): 未定义的引用google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet const&, google::protobuf::io::CodedOutputStream*)' ffm-model.o: In function
FFMmodel :: InternalSerializeWithCachedSizesToArray(布尔, unsigned char *)const':model.pb.cc :(. text + 0xee01):未定义的引用 至google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*)' ffm-model.o: In function
FFMmodel :: ByteSizeLong()const':model.pb.cc :(. text + 0xxec5):undefined 参考google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(google::protobuf::UnknownFieldSet const&)' model.pb.cc:(.text+0xed9): undefined reference to
谷歌:: protobuf的::内部:: WireFormatLite :: Int32Size(谷歌:: protobuf的:: RepeatedField const&amp;)'ffm-model.o:在函数中FFMmodel::MergeFrom(google::protobuf::Message const&)': model.pb.cc:(.text+0x101f): undefined reference to
谷歌:: protobuf的::内部::的LogMessage ::的LogMessage(谷歌:: protobuf的::日志级别 char const *,int)'model.pb.cc :(。text + 0x1035):未定义的引用google::protobuf::internal::LogMessage::operator<<(char const*)' model.pb.cc:(.text+0x104d): undefined reference to
谷歌:: protobuf的::内部:: LogFinisher ::运算符=(谷歌:: protobuf的::内部::的LogMessage&安培)” model.pb.cc:(.text+0x1061):未定义的引用google::protobuf::internal::LogMessage::~LogMessage()' model.pb.cc:(.text+0x108e): undefined reference to
谷歌:: protobuf的::内部:: ReflectionOps ::合并(谷歌:: protobuf的::消息 const&amp;,google :: protobuf :: Message *)'model.pb.cc :(. text + 0xx10bc): 未定义的引用 `谷歌:: protobuf的::内部::的LogMessage ::〜的LogMessage()'
知道我做错了什么吗?