2016-11-18 2 views
2

nicht richtig verknüpfen Ich habe wie ein paar Tage versucht, eine C++ App zu bekommen, aber ich bin in der Bibliothek/DLL-Prozess stecken, habe ich Probleme mit diesen beiden.Kann Google Protobuf in VS2015

Ich habe die C++ Release für protobuf 3.0.0, die LIB gemacht und die DLL (die zwei von ihnen zu testen), habe ich dies, um die SLN

cmake -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="../install" ../cmake 

es zu bekommen gab mir eine lösung, die ich mit vs2015 geöffnet und zum debug kompiliert habe, dann kompilierte mir die dateien, dann habe ich die includes mit der .bat erstellt.

Also, wenn ich zu VS2015 gehen und versuchen, mit dem LIB verknüpft zu kompilieren, es gibt mir diesen Fehler

1>libprotobufd.lib(dynamic_message.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj 

Ich bin sicher, dass ich die App im lib Gebäude als Debug renne und das Spiel auch als Debug.

Auch habe ich versucht, die DLL (die Bibliothek zu löschen und die Referenzen), in der Spitze der main.cpp Datei „#define PROTOBUF_USE_DLLS“ schreiben, und ich bekomme eine Menge Linker Fehler wie diese

1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::internal::LogMessage::LogMessage(enum google::protobuf::LogLevel,char const *,int)" ([email protected]@[email protected]@@[email protected]@[email protected]@Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::internal::LogMessage::~LogMessage(void)" ([email protected]@[email protected]@@[email protected]) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: class google::protobuf::internal::LogMessage & __thiscall google::protobuf::internal::LogMessage::operator<<(char const *)" ([email protected]@[email protected]@@[email protected]@Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::internal::LogFinisher::operator=(class google::protobuf::internal::LogMessage &)" ([email protected]@[email protected]@@[email protected]@@Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::Closure::~Closure(void)" ([email protected]@[email protected]@[email protected]) referenced in function "public: virtual void * __thiscall google::protobuf::Closure::`scalar deleting destructor'(unsigned int)" ([email protected]@[email protected]@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::internal::FunctionClosure0::~FunctionClosure0(void)" ([email protected]@[email protected]@@[email protected]) referenced in function "public: virtual void * __thiscall google::protobuf::internal::FunctionClosure0::`scalar deleting destructor'(unsigned int)" ([email protected]@[email protected]@@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::VerifyVersion(int,int,char const *)" ([email protected]@[email protected]@@[email protected]) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::OnShutdown(void (__cdecl*)(void))" ([email protected]@[email protected]@@[email protected]) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: void * __thiscall google::protobuf::Arena::AllocateAligned(class type_info const *,unsigned int)" ([email protected]@[email protected]@@[email protected]@[email protected]) referenced in function "public: struct google::protobuf::internal::InternalMetadataWithArena::Container * __thiscall google::protobuf::Arena::CreateInternal<struct google::protobuf::internal::InternalMetadataWithArena::Container>(bool)" ([email protected]@[email protected]@[email protected]@@@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::Arena::AddListNode(void *,void (__cdecl*)(void *))" ([email protected]@[email protected]@@[email protected]@Z) referenced in function "public: struct google::protobuf::internal::InternalMetadataWithArena::Container * __thiscall google::protobuf::Arena::CreateInternal<struct google::protobuf::internal::InternalMetadataWithArena::Container>(bool)" ([email protected]@[email protected]@[email protected]@@@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::GoogleOnceInitImpl(int *,class google::protobuf::Closure *)" ([email protected]@[email protected]@[email protected]@@Z) referenced in function "void __cdecl google::protobuf::GoogleOnceInit(int *,void (__cdecl*)(void))" ([email protected]@[email protected]@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::MergeFromFail(char const *,int)" ([email protected]@[email protected]@@[email protected]) referenced in function "public: void __thiscall tryPhy::PhyData::MergeFrom(class tryPhy::PhyData const &)" ([email protected]@[email protected]@[email protected]@Z) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "private: void __thiscall google::protobuf::UnknownFieldSet::ClearFallback(void)" ([email protected]@[email protected]@@AAEXXZ) referenced in function "public: void __thiscall google::protobuf::UnknownFieldSet::Clear(void)" ([email protected]@[email protected]@@QAEXXZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class google::protobuf::MessageLite * __thiscall google::protobuf::MessageLite::New(class google::protobuf::Arena *)const " ([email protected]@[email protected][email protected]@[email protected]@[email protected]@Z) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall google::protobuf::MessageLite::InitializationErrorString(void)const " ([email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@XZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall google::protobuf::MessageLite::InternalSerializeWithCachedSizesToArray(bool,unsigned char *)const " ([email protected]@[email protected]@@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static class google::protobuf::DescriptorPool const * __cdecl google::protobuf::DescriptorPool::generated_pool(void)" ([email protected]@[email protected]@@[email protected]) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: class google::protobuf::FileDescriptor const * __thiscall google::protobuf::DescriptorPool::FindFileByName(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " ([email protected]@[email protected]@@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const *,int)" ([email protected]@[email protected]@@[email protected]) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::CopyFrom(class google::protobuf::Message const &)" ([email protected]@[email protected]@@[email protected]@Z) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::MergeFrom(class google::protobuf::Message const &)" ([email protected]@[email protected]@@[email protected]@Z) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall google::protobuf::Message::InitializationErrorString(void)const " ([email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@XZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::DiscardUnknownFields(void)" ([email protected]@[email protected]@@UAEXXZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall google::protobuf::Message::SpaceUsed(void)const " ([email protected]@[email protected]@@UBEHXZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall google::protobuf::Message::GetTypeName(void)const " ([email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@XZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::Clear(void)" ([email protected]@[email protected]@@UAEXXZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall google::protobuf::Message::IsInitialized(void)const " ([email protected]@[email protected]@@UBE_NXZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::CheckTypeAndMergeFrom(class google::protobuf::MessageLite const &)" ([email protected]@[email protected]@@[email protected]@@Z) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall google::protobuf::Message::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" ([email protected]@[email protected]@@[email protected]@[email protected]@Z) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall google::protobuf::Message::ByteSize(void)const " ([email protected]@[email protected]@@UBEHXZ) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " ([email protected]@[email protected]@@[email protected]@[email protected]@Z) 
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall google::protobuf::Message::SetCachedSize(int)const " ([email protected]@[email protected]@@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const *,void (__cdecl*)(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &))" ([email protected]@[email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(class google::protobuf::Descriptor const *,class google::protobuf::Message const *)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z) referenced in function "void __cdecl tryPhy::`anonymous namespace'::protobuf_RegisterTypes(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected][email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "private: bool __thiscall google::protobuf::io::CodedInputStream::ReadLittleEndian64Fallback(unsigned __int64 *)" ([email protected]@[email protected]@[email protected]@[email protected]) referenced in function "public: bool __thiscall google::protobuf::io::CodedInputStream::ReadLittleEndian64(unsigned __int64 *)" ([email protected]@[email protected]@[email protected]@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "private: unsigned int __thiscall google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)" ([email protected]@[email protected]@[email protected]@[email protected]) referenced in function "public: struct std::pair<unsigned int,bool> __thiscall google::protobuf::io::CodedInputStream::ReadTagWithCutoff(unsigned int)" ([email protected]@[email protected]@[email protected]@[email protected][email protected]@@[email protected]) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static bool __cdecl google::protobuf::internal::WireFormatLite::SkipField(class google::protobuf::io::CodedInputStream *,unsigned int)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "public: virtual bool __thiscall tryPhy::PhyData::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@Z) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::WireFormatLite::WriteDouble(int,double,class google::protobuf::io::CodedOutputStream *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "public: virtual void __thiscall tryPhy::PhyData::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " ([email protected]@[email protected]@[email protected]@[email protected]@@@Z) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static class google::protobuf::internal::GeneratedMessageReflection * __cdecl google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(class google::protobuf::Descriptor const *,class google::protobuf::Message const *,int const * const,int,int,int,int,int,int)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" ([email protected]@@YAXXZ) 
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::ReflectionOps::Merge(class google::protobuf::Message const &,class google::protobuf::Message *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "public: virtual void __thiscall tryPhy::PhyData::MergeFrom(class google::protobuf::Message const &)" ([email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>bin\windows\multiplayer.exe : fatal error LNK1120: 40 unresolved externals 

Ich bin ein bisschen verloren und stecken geblieben, also wenn mir jemand helfen kann umzuleiten, wo ich suchen muss, werde ich dankbar sein.

Vielen Dank für Ihre Zeit

+0

Wenn Sie hier keine Antwort erhalten, versuchen Sie, auf der protobuf Google-Gruppe zu posten oder ein Problem auf GitHub zu stellen (https://github.com/google/protobuf). –

Antwort

1

Da ich nicht kommentieren kann, wird dies als eine Antwort schreiben. Wenn ich die Struktur Ihrer Projekte richtig verstanden habe, dieses Ding:

`1>libprotobufd.lib(dynamic_message.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj` 

sagt Ihnen, dass die Runtime library Einstellung für die Bibliothek, die Sie versuchen, zu verknüpfen und das Projekt nicht übereinstimmt. Überprüfen Sie Project Properties -> C/C++ -> Code generation -> Runtime Library und stellen Sie sicher, dass diese Einstellung für beide Projekte gleich ist.

P.S. Auch ein Problem mit der statischen Bibliothek mit Proto-Dateien in vs2015 Update 3 hat aber scheint, dass Ihr Fall anders ist ..

1

Vielleicht sollten Sie die PROTOBUF_USE_DLLS definieren in den Visual Studio-Projekteigenschaften unter C/C++ -> Preprocessor hinzufügen > Präprozessor-Definitionen? Ich schätze, Sie müssen möglicherweise definieren, wenn Protobuf die Protobuf-Ausgabe cpp-Dateien auch zu kompilieren.

Verwandte Themen