5

我尽我所能遵循了指示。下载的 GPBuffers 5.0rc1 将 src/google 文件夹放入我的项目目录。添加了设置 > C/C++ > “其他包含目录”的路径。

但我认为我需要在某处放置一个 -lprotobuf 编译器选项。我尝试在“设置”>“xxx”>“附加命令行参数”中将其添加到 C/C++ 和链接器中。

但没有运气。

似乎缺少 libprotobuf.lib、libprotobuf-lite.lib 和 libprotoc.lib。也许它没有正确构建..

我的 serverThread.cpp 看起来像:

#include "serverThread.h"
#include "sendStruct.h"

#include <fstream>
#include <string>
#include "messages.pb.h"

日志转载如下。

它似乎缺少对某些库的引用。因为大多数依赖项都在那里。

Error   62  error LNK1120: 60 unresolved externals  C:\work\freetimeC+\ServerUpdater\Debug\ServerUpdater.exe
Error   37  error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const google::protobuf::internal::kEmptyString" (?kEmptyString@internal@protobuf@google@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   34  error LNK2001: unresolved external symbol "private: virtual void __thiscall google::protobuf::Message::SetCachedSize(int)const " (?SetCachedSize@Message@protobuf@google@@EBEXH@Z)  C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   27  error LNK2001: unresolved external symbol "public: virtual bool __thiscall google::protobuf::Message::IsInitialized(void)const " (?IsInitialized@Message@protobuf@google@@UBE_NXZ)  C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   28  error LNK2001: unresolved external symbol "public: virtual bool __thiscall google::protobuf::Message::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" (?MergePartialFromCodedStream@Message@protobuf@google@@UAE_NPAVCodedInputStream@io@23@@Z)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   21  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 " (?GetTypeName@Message@protobuf@google@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   22  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 " (?InitializationErrorString@Message@protobuf@google@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   35  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 " (?InitializationErrorString@MessageLite@protobuf@google@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   29  error LNK2001: unresolved external symbol "public: virtual int __thiscall google::protobuf::Message::ByteSize(void)const " (?ByteSize@Message@protobuf@google@@UBEHXZ)  C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   25  error LNK2001: unresolved external symbol "public: virtual int __thiscall google::protobuf::Message::SpaceUsed(void)const " (?SpaceUsed@Message@protobuf@google@@UBEHXZ)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   31  error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall google::protobuf::MessageLite::SerializeWithCachedSizesToArray(unsigned char *)const " (?SerializeWithCachedSizesToArray@MessageLite@protobuf@google@@UBEPAEPAE@Z)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   23  error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::CheckTypeAndMergeFrom(class google::protobuf::MessageLite const &)" (?CheckTypeAndMergeFrom@Message@protobuf@google@@UAEXABVMessageLite@23@@Z)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   26  error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::Clear(void)" (?Clear@Message@protobuf@google@@UAEXXZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   32  error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::CopyFrom(class google::protobuf::Message const &)" (?CopyFrom@Message@protobuf@google@@UAEXABV123@@Z) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   24  error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::DiscardUnknownFields(void)" (?DiscardUnknownFields@Message@protobuf@google@@UAEXXZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   33  error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::MergeFrom(class google::protobuf::Message const &)" (?MergeFrom@Message@protobuf@google@@UAEXABV123@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   30  error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes@Message@protobuf@google@@UBEXPAVCodedOutputStream@io@23@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   43  error LNK2019: unresolved external symbol "private: bool __thiscall google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int *)" (?ReadVarint32Fallback@CodedInputStream@io@protobuf@google@@AAE_NPAI@Z) referenced in function "public: bool __thiscall google::protobuf::io::CodedInputStream::ReadVarint32(unsigned int *)" (?ReadVarint32@CodedInputStream@io@protobuf@google@@QAE_NPAI@Z) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   53  error LNK2019: unresolved external symbol "private: static int __cdecl google::protobuf::io::CodedOutputStream::VarintSize32Fallback(unsigned int)" (?VarintSize32Fallback@CodedOutputStream@io@protobuf@google@@CAHI@Z) referenced in function "public: static int __cdecl google::protobuf::io::CodedOutputStream::VarintSize32(unsigned int)" (?VarintSize32@CodedOutputStream@io@protobuf@google@@SAHI@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   49  error LNK2019: unresolved external symbol "private: static unsigned char * __cdecl google::protobuf::io::CodedOutputStream::WriteVarint32FallbackToArray(unsigned int,unsigned char *)" (?WriteVarint32FallbackToArray@CodedOutputStream@io@protobuf@google@@CAPAEIPAE@Z) referenced in function "public: static unsigned char * __cdecl google::protobuf::io::CodedOutputStream::WriteTagToArray(unsigned int,unsigned char *)" (?WriteTagToArray@CodedOutputStream@io@protobuf@google@@SAPAEIPAE@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   44  error LNK2019: unresolved external symbol "private: static void __cdecl google::protobuf::internal::WireFormat::VerifyUTF8StringFallback(char const *,int,enum google::protobuf::internal::WireFormat::Operation)" (?VerifyUTF8StringFallback@WireFormat@internal@protobuf@google@@CAXPBDHW4Operation@1234@@Z) referenced in function "public: static void __cdecl google::protobuf::internal::WireFormat::VerifyUTF8String(char const *,int,enum google::protobuf::internal::WireFormat::Operation)" (?VerifyUTF8String@WireFormat@internal@protobuf@google@@SAXPBDHW4Operation@1234@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   42  error LNK2019: unresolved external symbol "private: unsigned int __thiscall google::protobuf::io::CodedInputStream::ReadTagFallback(void)" (?ReadTagFallback@CodedInputStream@io@protobuf@google@@AAEIXZ) referenced in function "public: unsigned int __thiscall google::protobuf::io::CodedInputStream::ReadTag(void)" (?ReadTag@CodedInputStream@io@protobuf@google@@QAEIXZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   38  error LNK2019: unresolved external symbol "private: void __thiscall google::protobuf::UnknownFieldSet::ClearFallback(void)" (?ClearFallback@UnknownFieldSet@protobuf@google@@AAEXXZ) referenced in function "public: void __thiscall google::protobuf::UnknownFieldSet::Clear(void)" (?Clear@UnknownFieldSet@protobuf@google@@QAEXXZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   61  error LNK2019: unresolved external symbol "protected: void __thiscall google::protobuf::internal::RepeatedPtrFieldBase::Reserve(int)" (?Reserve@RepeatedPtrFieldBase@internal@protobuf@google@@IAEXH@Z) referenced in function "protected: class ArchProtocol::Person_PhoneNumber * __thiscall google::protobuf::internal::RepeatedPtrFieldBase::Add<class google::protobuf::RepeatedPtrField<class ArchProtocol::Person_PhoneNumber>::TypeHandler>(void)" (??$Add@VTypeHandler@?$RepeatedPtrField@VPerson_PhoneNumber@ArchProtocol@@@protobuf@google@@@RepeatedPtrFieldBase@internal@protobuf@google@@IAEPAVPerson_PhoneNumber@ArchProtocol@@XZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   58  error LNK2019: unresolved external symbol "protected: void __thiscall google::protobuf::internal::RepeatedPtrFieldBase::Swap(class google::protobuf::internal::RepeatedPtrFieldBase *)" (?Swap@RepeatedPtrFieldBase@internal@protobuf@google@@IAEXPAV1234@@Z) referenced in function "public: void __thiscall google::protobuf::RepeatedPtrField<class ArchProtocol::Person_PhoneNumber>::Swap(class google::protobuf::RepeatedPtrField<class ArchProtocol::Person_PhoneNumber> *)" (?Swap@?$RepeatedPtrField@VPerson_PhoneNumber@ArchProtocol@@@protobuf@google@@QAEXPAV123@@Z)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   2   error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(class google::protobuf::Descriptor const *,class google::protobuf::Message const *,int const * const,int,int,int,class google::protobuf::DescriptorPool const *,class google::protobuf::MessageFactory *,int)" (??0GeneratedMessageReflection@internal@protobuf@google@@QAE@PBVDescriptor@23@PBVMessage@23@QBHHHHPBVDescriptorPool@23@PAVMessageFactory@23@H@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   4   error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::internal::LogMessage::~LogMessage(void)" (??1LogMessage@internal@protobuf@google@@QAE@XZ) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   7   error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::internal::LogMessage::LogMessage(enum google::protobuf::LogLevel,char const *,int)" (??0LogMessage@internal@protobuf@google@@QAE@W4LogLevel@23@PBDH@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   18  error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::UnknownFieldSet::~UnknownFieldSet(void)" (??1UnknownFieldSet@protobuf@google@@QAE@XZ) referenced in function __unwindfunclet$??0Person_PhoneNumber@ArchProtocol@@QAE@XZ$0   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   20  error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::UnknownFieldSet::UnknownFieldSet(void)" (??0UnknownFieldSet@protobuf@google@@QAE@XZ) referenced in function "public: __thiscall ArchProtocol::Person_PhoneNumber::Person_PhoneNumber(void)" (??0Person_PhoneNumber@ArchProtocol@@QAE@XZ)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   8   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 " (?FindFileByName@DescriptorPool@protobuf@google@@QBEPBVFileDescriptor@23@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   6   error LNK2019: unresolved external symbol "public: class google::protobuf::internal::LogMessage & __thiscall google::protobuf::internal::LogMessage::operator<<(char const *)" (??6LogMessage@internal@protobuf@google@@QAEAAV0123@PBD@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   60  error LNK2019: unresolved external symbol "public: int __thiscall google::protobuf::io::CodedInputStream::PushLimit(int)" (?PushLimit@CodedInputStream@io@protobuf@google@@QAEHH@Z) referenced in function "public: static bool __cdecl google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual<class ArchProtocol::Person_PhoneNumber>(class google::protobuf::io::CodedInputStream*,class ArchProtocol::Person_PhoneNumber *)" (??$ReadMessageNoVirtual@VPerson_PhoneNumber@ArchProtocol@@@WireFormatLite@internal@protobuf@google@@SA_NPAVCodedInputStream@io@23@PAVPerson_PhoneNumber@ArchProtocol@@@Z)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   39  error LNK2019: unresolved external symbol "public: static bool __cdecl google::protobuf::internal::WireFormat::SkipField(class google::protobuf::io::CodedInputStream *,unsigned int,class google::protobuf::UnknownFieldSet *)" (?SkipField@WireFormat@internal@protobuf@google@@SA_NPAVCodedInputStream@io@34@IPAVUnknownFieldSet@34@@Z) referenced in function "public: virtual bool __thiscall ArchProtocol::Person_PhoneNumber::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" (?MergePartialFromCodedStream@Person_PhoneNumber@ArchProtocol@@UAE_NPAVCodedInputStream@io@protobuf@google@@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   41  error LNK2019: unresolved external symbol "public: static bool __cdecl google::protobuf::internal::WireFormatLite::ReadString(class google::protobuf::io::CodedInputStream *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?ReadString@WireFormatLite@internal@protobuf@google@@SA_NPAVCodedInputStream@io@34@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual bool __thiscall ArchProtocol::Person_PhoneNumber::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" (?MergePartialFromCodedStream@Person_PhoneNumber@ArchProtocol@@UAE_NPAVCodedInputStream@io@protobuf@google@@@Z) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   9   error LNK2019: unresolved external symbol "public: static class google::protobuf::DescriptorPool const * __cdecl google::protobuf::DescriptorPool::generated_pool(void)" (?generated_pool@DescriptorPool@protobuf@google@@SAPBV123@XZ) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   3   error LNK2019: unresolved external symbol "public: static class google::protobuf::MessageFactory * __cdecl google::protobuf::MessageFactory::generated_factory(void)" (?generated_factory@MessageFactory@protobuf@google@@SAPAV123@XZ) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   52  error LNK2019: unresolved external symbol "public: static int __cdecl google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(class google::protobuf::UnknownFieldSet const &)" (?ComputeUnknownFieldsSize@WireFormat@internal@protobuf@google@@SAHABVUnknownFieldSet@34@@Z) referenced in function "public: virtual int __thiscall ArchProtocol::Person_PhoneNumber::ByteSize(void)const " (?ByteSize@Person_PhoneNumber@ArchProtocol@@UBEHXZ)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   48  error LNK2019: unresolved external symbol "public: static unsigned char * __cdecl google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(class google::protobuf::UnknownFieldSet const &,unsigned char *)" (?SerializeUnknownFieldsToArray@WireFormat@internal@protobuf@google@@SAPAEABVUnknownFieldSet@34@PAE@Z) referenced in function "public: virtual unsigned char * __thiscall ArchProtocol::Person_PhoneNumber::SerializeWithCachedSizesToArray(unsigned char *)const " (?SerializeWithCachedSizesToArray@Person_PhoneNumber@ArchProtocol@@UBEPAEPAE@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   51  error LNK2019: unresolved external symbol "public: static unsigned char * __cdecl google::protobuf::io::CodedOutputStream::WriteRawToArray(void const *,int,unsigned char *)" (?WriteRawToArray@CodedOutputStream@io@protobuf@google@@SAPAEPBXHPAE@Z) referenced in function "public: static unsigned char * __cdecl google::protobuf::io::CodedOutputStream::WriteStringToArray(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned char *)" (?WriteStringToArray@CodedOutputStream@io@protobuf@google@@SAPAEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAE@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   50  error LNK2019: unresolved external symbol "public: static unsigned char * __cdecl google::protobuf::io::CodedOutputStream::WriteVarint64ToArray(unsigned __int64,unsigned char *)" (?WriteVarint64ToArray@CodedOutputStream@io@protobuf@google@@SAPAE_KPAE@Z) referenced in function "public: static unsigned char * __cdecl google::protobuf::io::CodedOutputStream::WriteVarint32SignExtendedToArray(int,unsigned char *)" (?WriteVarint32SignExtendedToArray@CodedOutputStream@io@protobuf@google@@SAPAEHPAE@Z)  C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   16  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const *,int)" (?InternalAddGeneratedFile@DescriptorPool@protobuf@google@@SAXPBXH@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AddDesc_messages_2eproto(void)" (?protobuf_AddDesc_messages_2eproto@ArchProtocol@@YAXXZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   54  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::ReflectionOps::Merge(class google::protobuf::Message const &,class google::protobuf::Message *)" (?Merge@ReflectionOps@internal@protobuf@google@@SAXABVMessage@34@PAV534@@Z) referenced in function "public: virtual void __thiscall ArchProtocol::Person_PhoneNumber::MergeFrom(class google::protobuf::Message const &)" (?MergeFrom@Person_PhoneNumber@ArchProtocol@@UAEXABVMessage@protobuf@google@@@Z)  C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   45  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::WireFormat::SerializeUnknownFields(class google::protobuf::UnknownFieldSet const &,class google::protobuf::io::CodedOutputStream *)" (?SerializeUnknownFields@WireFormat@internal@protobuf@google@@SAXABVUnknownFieldSet@34@PAVCodedOutputStream@io@34@@Z) referenced in function "public:virtual void __thiscall ArchProtocol::Person_PhoneNumber::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes@Person_PhoneNumber@ArchProtocol@@UBEXPAVCodedOutputStream@io@protobuf@google@@@Z)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   46  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::WireFormatLite::WriteEnum(int,int,class google::protobuf::io::CodedOutputStream *)" (?WriteEnum@WireFormatLite@internal@protobuf@google@@SAXHHPAVCodedOutputStream@io@34@@Z) referenced in function "public: virtual void __thiscall ArchProtocol::Person_PhoneNumber::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes@Person_PhoneNumber@ArchProtocol@@UBEXPAVCodedOutputStream@io@protobuf@google@@@Z) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   57  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::WireFormatLite::WriteInt32(int,int,class google::protobuf::io::CodedOutputStream *)" (?WriteInt32@WireFormatLite@internal@protobuf@google@@SAXHHPAVCodedOutputStream@io@34@@Z) referenced in function "public: virtual void __thiscall ArchProtocol::Person::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes@Person@ArchProtocol@@UBEXPAVCodedOutputStream@io@protobuf@google@@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   56  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(int,class google::protobuf::MessageLite const &,class google::protobuf::io::CodedOutputStream *)" (?WriteMessageMaybeToArray@WireFormatLite@internal@protobuf@google@@SAXHABVMessageLite@34@PAVCodedOutputStream@io@34@@Z) referenced in function"public: virtual void __thiscall ArchProtocol::Person::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes@Person@ArchProtocol@@UBEXPAVCodedOutputStream@io@protobuf@google@@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   47  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::WireFormatLite::WriteString(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class google::protobuf::io::CodedOutputStream *)" (?WriteString@WireFormatLite@internal@protobuf@google@@SAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVCodedOutputStream@io@34@@Z) referenced in function "public: virtual void __thiscall ArchProtocol::Person_PhoneNumber::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes@Person_PhoneNumber@ArchProtocol@@UBEXPAVCodedOutputStream@io@protobuf@google@@@Z)  C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   15  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 &))" (?InternalRegisterGeneratedFile@MessageFactory@protobuf@google@@SAXPBDP6AXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AddDesc_messages_2eproto(void)" (?protobuf_AddDesc_messages_2eproto@ArchProtocol@@YAXXZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   10  error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(class google::protobuf::Descriptor const *,class google::protobuf::Message const *)" (?InternalRegisterGeneratedMessage@MessageFactory@protobuf@google@@SAXPBVDescriptor@23@PBVMessage@23@@Z) referenced in function "void __cdecl ArchProtocol::`anonymous namespace'::protobuf_RegisterTypes(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?protobuf_RegisterTypes@?A0x2751caee@ArchProtocol@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   13  error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::Closure::~Closure(void)" (??1Closure@protobuf@google@@UAE@XZ) referenced in function "public: virtual void * __thiscall google::protobuf::Closure::`scalar deleting destructor'(unsigned int)" (??_GClosure@protobuf@google@@UAEPAXI@Z) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   11  error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::internal::FunctionClosure0::~FunctionClosure0(void)" (??1FunctionClosure0@internal@protobuf@google@@UAE@XZ) referenced in function "void __cdecl google::protobuf::GoogleOnceInit(int *,void (__cdecl*)(void))" (?GoogleOnceInit@protobuf@google@@YAXPAHP6AXXZ@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   19  error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::Message::~Message(void)" (??1Message@protobuf@google@@UAE@XZ) referenced in function __unwindfunclet$??0Person_PhoneNumber@ArchProtocol@@QAE@XZ$0   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   36  error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::MessageLite::~MessageLite(void)" (??1MessageLite@protobuf@google@@UAE@XZ) referenced in function "public: virtual void * __thiscall google::protobuf::MessageLite::`scalar deleting destructor'(unsigned int)" (??_GMessageLite@protobuf@google@@UAEPAXI@Z) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   5   error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::internal::LogFinisher::operator=(class google::protobuf::internal::LogMessage &)" (??4LogFinisher@internal@protobuf@google@@QAEXAAVLogMessage@123@@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AssignDesc_messages_2eproto(void)" (?protobuf_AssignDesc_messages_2eproto@ArchProtocol@@YAXXZ)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   59  error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::io::CodedInputStream::PopLimit(int)" (?PopLimit@CodedInputStream@io@protobuf@google@@QAEXH@Z) referenced in function "public: static bool __cdecl google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual<class ArchProtocol::Person_PhoneNumber>(class google::protobuf::io::CodedInputStream *,class ArchProtocol::Person_PhoneNumber *)" (??$ReadMessageNoVirtual@VPerson_PhoneNumber@ArchProtocol@@@WireFormatLite@internal@protobuf@google@@SA_NPAVCodedInputStream@io@23@PAVPerson_PhoneNumber@ArchProtocol@@@Z)    C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   40  error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::UnknownFieldSet::AddVarint(int,unsigned __int64)" (?AddVarint@UnknownFieldSet@protobuf@google@@QAEXH_K@Z) referenced in function "public: virtual bool __thiscall ArchProtocol::Person_PhoneNumber::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" (?MergePartialFromCodedStream@Person_PhoneNumber@ArchProtocol@@UAE_NPAVCodedInputStream@io@protobuf@google@@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   55  error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::UnknownFieldSet::MergeFrom(class google::protobuf::UnknownFieldSet const &)" (?MergeFrom@UnknownFieldSet@protobuf@google@@QAEXABV123@@Z) referenced in function "public: void __thiscall ArchProtocol::Person_PhoneNumber::MergeFrom(class ArchProtocol::Person_PhoneNumber const &)" (?MergeFrom@Person_PhoneNumber@ArchProtocol@@QAEXABV12@@Z)   C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   12  error LNK2019: unresolved external symbol "void __cdecl google::protobuf::GoogleOnceInitImpl(int *,class google::protobuf::Closure *)" (?GoogleOnceInitImpl@protobuf@google@@YAXPAHPAVClosure@12@@Z) referenced in function "void __cdecl google::protobuf::GoogleOnceInit(int *,void (__cdecl*)(void))" (?GoogleOnceInit@protobuf@google@@YAXPAHP6AXXZ@Z)  C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   14  error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::OnShutdown(void (__cdecl*)(void))" (?OnShutdown@internal@protobuf@google@@YAXP6AXXZ@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AddDesc_messages_2eproto(void)" (?protobuf_AddDesc_messages_2eproto@ArchProtocol@@YAXXZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
Error   17  error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::VerifyVersion(int,int,char const *)" (?VerifyVersion@internal@protobuf@google@@YAXHHPBD@Z) referenced in function "void __cdecl ArchProtocol::protobuf_AddDesc_messages_2eproto(void)" (?protobuf_AddDesc_messages_2eproto@ArchProtocol@@YAXXZ) C:\work\freetimeC+\ServerUpdater\ServerUpdater\messages.pb.obj
4

2 回答 2

8

需要正确编译 Protobuf。有一个 vsprojects 文件夹。只需构建 libprotobuf 并添加 libprotobuf.lib 作为对项目的引用,方法是:

属性 > 链接器 > 输入:附加依赖项 > 编辑...

如果您将其复制到您的项目文件夹/google 中,请放入 google/libprotobuf.lib

现在一切都应该顺利编译。

于 2012-12-05T23:20:27.693 回答
6

如果您将 protobufs 构建为 DLL,那么您还需要PROTOBUF_USE_DLLS在客户端应用程序中进行定义,以使其正确提取 DLL 导入__declspec内容。

有关详细信息,请参阅https://code.google.com/p/protobuf/issues/detail?id=308#c9

于 2013-04-17T16:18:51.677 回答