Well, now I'm convinced my problem was directly related to visual
studio. I originally started this project in VS2003 so I wouldn't have
to cart around a bunch of vc90 dlls. However, I build libprotobuf in
vs 2008. That threw me off at one point, I thought my problems were
related to the version difference, so I opened my test project in
vs2008, and my solution/project files were upgraded to 2008. I still
had the same linking errors and came here. After you confirmed I
should link directly to the .lib file, I started over. I created a
fresh project and meticulously added files and built after each file.
By the time I was finished adding files, I still didn't have any
linker errors. I don't know what the problem was, but it's working
now.


On Apr 8, 4:10 pm, Kenton Varda <ken...@google.com> wrote:
> On Wed, Apr 8, 2009 at 2:01 PM, <scotty2...@gmail.com> wrote:
>
> > I don't know how else to link to libprotobuf.lib. Here's the resulting
> > command lines of the options I've tried:
>
> > /LIBPATH :"C:\Development\Libraries\lib" contains the output of the
> > files built using the project files in vsprojects folder included in
> > the protobuf source.
>
> > First, I'm not speciyfing libprotobuf.lib, but including the libpath
> > containing libprotobuf.lib (I think this is the way I'm supposed to
> > link it):
>
> No, you have to explicitly specify libprotobuf.lib.  The compiler will not
> automatically try to link everything in the directory.
>
> Sorry, I'm not very familiar with MSVC so I'm not sure exactly what you have
> to do, but you *do* have to explicitly specify libprotobuf.lib.
>
> > /OUT:"Release/backupcomm.exe" /NOLOGO /LIBPATH:"C:\Development
> > \Libraries\lib" /LIBPATH:"C:\Program Files\Microsoft Platform SDK
> > \Lib" /MANIFEST /MANIFESTFILE:"Release
> > \backupcomm.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker'
> > uiAccess='false'" /DEBUG /PDB:"c:\Development\Projects\BackupDirector
> > \v2\backupcomm\backupcomm\Release\backupcomm.pdb" /SUBSYSTEM:CONSOLE /
> > OPT:REF /OPT:ICF /DYNAMICBASE:NO /MACHINE:X86 /ERRORREPORT:PROMPT
> > ws2_32.lib wsock32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib
> > comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
> > odbc32.lib odbccp32.lib
>
> > Explicitly specifying libprotobuf.lib as well:
>
> > /OUT:"Release/backupcomm.exe" /NOLOGO /LIBPATH:"C:\Development
> > \Libraries\lib" /LIBPATH:"C:\Program Files\Microsoft Platform SDK
> > \Lib" /MANIFEST /MANIFESTFILE:"Release
> > \backupcomm.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker'
> > uiAccess='false'" /DEBUG /PDB:"c:\Development\Projects\BackupDirector
> > \v2\backupcomm\backupcomm\Release\backupcomm.pdb" /SUBSYSTEM:CONSOLE /
> > OPT:REF /OPT:ICF /DYNAMICBASE:NO /MACHINE:X86 /ERRORREPORT:PROMPT
> > ws2_32.lib wsock32.lib c:\development\libraries\lib\libprotobuf.lib
> > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
> > advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
> > odbccp32.lib
>
> > On Apr 8, 1:09 pm, Kenton Varda <ken...@google.com> wrote:
> > > It appears you are not linking against libprotobuf.lib.
>
> > > On Wed, Apr 8, 2009 at 8:28 AM, <scotty2...@gmail.com> wrote:
>
> > > > I think part of my problem was using precompiled headers in the
> > > > project. I've removed that option and recreated my project, but I
> > > > still get these linker errors:
>
> > > > backupcomm error LNK2019: unresolved external symbol "public: static
> > > > class google::protobuf::MessageFactory * __cdecl
> > > > google::protobuf::MessageFactory::generated_factory(void)" (?
> > > > generated_fact...@messagefactory@proto...@google@@sapav...@xz)
> > > > referenced in function "public: __thiscall backupcomm::Actions::Actions
> > > > (void)" (??0acti...@backupcomm@@q...@xz)
> > > > backupcomm error LNK2019: unresolved external symbol "public: static
> > > > void __cdecl
> > > > google::protobuf::MessageFactory::InternalRegisterGeneratedMessage
> > > > (class google::protobuf::Descriptor const *,class
> > > > google::protobuf::Message const *)" (?
> > > > internalregistergeneratedmess...@messagefactory@proto...@google
> > > > @@saxpbvdescrip...@23@pbvmess...@23@@Z)
> > > > referenced in function "void __cdecl
> > > > backupcomm::protobuf_BuildDesc_def_2eproto_AssignGlobalDescriptors
> > > > (class google::protobuf::FileDescriptor const *)" (?
> > > > protobuf_builddesc_def_2eproto_assignglobaldescript...@backupcomm
> > > > @@yaxpbvfiledescrip...@protobuf@google@@@Z)
> > > > backupcomm 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 *,int)" (??
> > > > 0generatedmessagereflect...@internal@proto...@google
> > @@q...@pbvdescriptor
> > > > @2...@pbvmessage@2...@qbhhhhpbvdescriptorpool@2...@h@Z)
> > > > referenced in function "void __cdecl
> > > > backupcomm::protobuf_BuildDesc_def_2eproto_AssignGlobalDescriptors
> > > > (class google::protobuf::FileDescriptor const *)" (?
> > > > protobuf_builddesc_def_2eproto_assignglobaldescript...@backupcomm
> > > > @@yaxpbvfiledescrip...@protobuf@google@@@Z)
> > > > backupcomm error LNK2019: unresolved external symbol "public: static
> > > > class google::protobuf::DescriptorPool const * __cdecl
> > > > google::protobuf::DescriptorPool::generated_pool(void)" (?
> > > > generated_p...@descriptorpool@proto...@google@@sapbv...@xz) referenced
> > > > in function "void __cdecl
> > > > backupcomm::protobuf_BuildDesc_def_2eproto_AssignGlobalDescriptors
> > > > (class google::protobuf::FileDescriptor const *)" (?
> > > > protobuf_builddesc_def_2eproto_assignglobaldescript...@backupcomm
> > > > @@yaxpbvfiledescrip...@protobuf@google@@@Z)
> > > > backupcomm error LNK2019: unresolved external symbol "public: class
> > > > google::protobuf::FileDescriptor const * __thiscall
> > > > google::protobuf::DescriptorPool::InternalBuildGeneratedFile(void
> > > > const *,int,void (__cdecl*)(class google::protobuf::FileDescriptor
> > > > const *))" (?
> > > > internalbuildgeneratedf...@descriptorpool@proto...@google
> > > > @@qaepbvfiledescrip...@23@PBXHP6AXPBV423@@z...@z)
> > > > referenced in function "void __cdecl
> > > > backupcomm::protobuf_BuildDesc_def_2eproto(void)" (?
> > > > protobuf_builddesc_def_2epr...@backupcomm@@YAXXZ)
> > > > backupcomm error LNK2019: unresolved external symbol "public: static
> > > > class google::protobuf::DescriptorPool * __cdecl
> > > > google::protobuf::DescriptorPool::internal_generated_pool(void)" (?
> > > > internal_generated_p...@descriptorpool@proto...@google@@sapav...@xz)
> > > > referenced in function "void __cdecl
> > > > backupcomm::protobuf_BuildDesc_def_2eproto(void)" (?
> > > > protobuf_builddesc_def_2epr...@backupcomm@@YAXXZ)
> > > > backupcomm error LNK2019: unresolved external symbol "void __cdecl
> > > > google::protobuf::internal::VerifyVersion(int,int,char const *)" (?
> > > > verifyvers...@internal@proto...@google@@yaxhh...@z) referenced in
> > > > function "void __cdecl backupcomm::protobuf_BuildDesc_def_2eproto
> > > > (void)" (?protobuf_builddesc_def_2epr...@backupcomm@@YAXXZ)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > bool __thiscall google::protobuf::Message::SerializeWithCachedSizes
> > > > (class google::protobuf::io::CodedOutputStream *)const " (?
> > > > serializewithcachedsi...@message@proto...@google
> > > > @@ube_npavcodedoutputstr...@io@23@@Z)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > int __thiscall google::protobuf::Message::SpaceUsed(void)const " (?
> > > > spaceu...@message@proto...@google@@UBEHXZ)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > int __thiscall google::protobuf::Message::ByteSize(void)const " (?
> > > > bytes...@message@proto...@google@@UBEHXZ)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > bool __thiscall google::protobuf::Message::MergePartialFromCodedStream
> > > > (class google::protobuf::io::CodedInputStream *)" (?
> > > > mergepartialfromcodedstr...@message@proto...@google
> > > > @@uae_npavcodedinputstr...@io@23@@Z)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > void __thiscall google::protobuf::Message::DiscardUnknownFields
> > > > (void)" (?discardunknownfie...@message@proto...@google@@UAEXXZ)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > bool __thiscall google::protobuf::Message::IsInitialized(void)const
> > > > " (?isinitiali...@message@proto...@google@@UBE_NXZ)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > void __thiscall google::protobuf::Message::Clear(void)" (?
> > > > cl...@message@proto...@google@@UAEXXZ)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > void __thiscall google::protobuf::Message::MergeFrom(class
> > > > google::protobuf::Message const &)" (?
> > > > mergef...@message@proto...@google@@UAEXABV123@@Z)
> > > > backupcomm error LNK2001: unresolved external symbol "public: virtual
> > > > void __thiscall google::protobuf::Message::CopyFrom(class
> > > > google::protobuf::Message const &)" (?
> > > > copyf...@message@proto...@google@@UAEXABV123@@Z)
> > > > backupcomm error LNK2019: unresolved external symbol "public: virtual
> > > > __thiscall google::protobuf::Message::~Message(void)" (??
> > > > 1mess...@protobuf@google@@u...@xz) referenced in function
> > > > __unwindfunclet$??0mess...@backupcomm@@q...@xz$0
> > > > backupcomm error LNK2019: unresolved external symbol "public:
> > > > __thiscall google::protobuf::UnknownFieldSet::UnknownFieldSet
> > > > (void)" (??0unknownfield...@protobuf@google@@q...@xz) referenced in
> > > > function "public: __thiscall backupcomm::Message::Message(void)" (??
> > > > 0mess...@backupcomm@@q...@xz)
> > > > backupcomm error LNK2001: unresolved external symbol "private: virtual
> > > > void __thiscall google::protobuf::Message::SetCachedSize(int)const " (?
> > > > setcacheds...@message@proto...@google@@eb...@z)
> > > > backupcomm error LNK2019: unresolved external symbol "public:
> > > > __thiscall google::protobuf::UnknownFieldSet::~UnknownFieldSet
> > > > (void)" (??1unknownfield...@protobuf@google@@q...@xz) referenced in
> > > > function __unwindfunclet$??0mess...@backupcomm@@q...@abv01@@Z$0
> > > > backupcomm error LNK2019: unresolved external symbol "public:
> > > > __thiscall google::protobuf::internal::ExtensionSet::~ExtensionSet
> > > > (void)" (??1extension...@internal@proto...@google@@q...@xz) referenced
> > > > in function __unwindfunclet$??0acti...@backupcomm@@q...@xz$0
> > > > backupcomm error LNK2019: unresolved external symbol "public:
> > > > __thiscall google::protobuf::internal::ExtensionSet::ExtensionSet
> > > > (class google::protobuf::Descriptor const * const *,class
> > > > google::protobuf::DescriptorPool const *,class
> > > > google::protobuf::MessageFactory *)" (??
> > > > 0extension...@internal@proto...@google@@q...@pbqbvdescriptor
> > > > @2...@pbvdescriptorpool@2...@pavmessagefactory@23@@Z)
> > > > referenced in function "public: __thiscall backupcomm::Actions::Actions
> > > > (void)" (??0acti...@backupcomm@@q...@xz)
>
> > > > On Apr 7, 6:21 pm, Kenton Varda <ken...@google.com> wrote:
> > > > > What are the errors?
>
> > > > > On Tue, Apr 7, 2009 at 3:58 PM, <scotty2...@gmail.com> wrote:
>
> > > > > > I am trying to get started using pb, but I am stuck. I've got my
> > > > > > messages compiled into their .h and .cc parts, i've added those to
> > my
> > > > > > project. I built protobuf in vs 2009, and I've added the
> > > > > > protobuf-2.0.3\src directory as an include location and the output
> > > > > > from the build as an additional library location. However, I can't
> > > > > > build my project (which has nothing other than the protoc generated
> > .h
> > > > > > and .cc files). I get a bunch of linker errors, did I miss
> > something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to