Re: Howto build protobuf not as library, but directly linking object files?
On Jul 9, 8:54 pm, Alex Black a...@alexblack.ca wrote: Hey Bart, I'm not sure I'm seeing the full details of your situation, But on windows I compiled a library libprotobuf.lib, and linked to it statically, meaning it gets built into the exe (or dll) you're building. (I built 2 actually, a release one and a debug one). That's how it works on Linux. Here's the problems we're having on Windows. We're building protoc with the mingw compiler system included in the Qt 4.5.1 SDK. This doesn't generate .lib files, but .la files and .a files. The .a is a static archive. When I run 'nm libprotobuf.a' I get all the typical protobuf function definitions, so that looks ok. However, when I try to build my application with -Lpath/to/ libprotobuf.a I get hundreds of linker errors, complaining about undefined references to any of the google protocol functions. I'm using the same mingw compiler to build my Qt application, so that is not the problem. Anyway, I'm still struggling with this stuff, and since no one at my company knows anything about C++ on Windows, it's a hassle. So that's why I just try to circumvent the problem by just linking the object files directly. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Howto build protobuf not as library, but directly linking object files?
On Fri, Jul 10, 2009 at 3:12 AM, bart van deenen bart.vandee...@gmail.comwrote: However, when I try to build my application with -Lpath/to/ libprotobuf.a I get hundreds of linker errors, complaining about undefined references to any of the google protocol functions. You need to use: -Lpath/to/lib/dir -lprotobuf The -L flag adds a directory which will be searched for libraries, whereas the -l flag says to link against a particular library. The compiler automatically prefixes the library name with lib and suffixes it with .a. Note that I test every release on MinGW. You can use MSYS to invoke the included configure script and makefiles, to build it just like you would on any Unix system. I'm using the same mingw compiler to build my Qt application, so that is not the problem. Anyway, I'm still struggling with this stuff, and since no one at my company knows anything about C++ on Windows, it's a hassle. So that's why I just try to circumvent the problem by just linking the object files directly. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Howto build protobuf not as library, but directly linking object files?
Thank you thank you thank you! You're my savior :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
RE: Howto build protobuf not as library, but directly linking object files?
Hey Bart, I'm not sure I'm seeing the full details of your situation, But on windows I compiled a library libprotobuf.lib, and linked to it statically, meaning it gets built into the exe (or dll) you're building. (I built 2 actually, a release one and a debug one). - Alex -Original Message- From: protobuf@googlegroups.com [mailto:proto...@googlegroups.com] On Behalf Of bart van deenen Sent: Thursday, July 09, 2009 2:44 PM To: Protocol Buffers Subject: Howto build protobuf not as library, but directly linking object files? Hi this question is stupid I know :-) I've succesfully built an application with a shared library, that uses protobuf. No problem whatsoever, on LINUX! Now I have to get the Windows guys involved in it, and they know nothing about shared libraries, linker paths and such. Well neither do I but I don't use Windows, so I have an excuse. I use Qt, which has qmake which generates Makefiles. Can I just compile the files in the protobuf directory directly, and just link with the object files? Which files would I need? All files, are there files that I can skip? . |-- google | `-- protobuf | |-- compiler | | |-- cpp | | |-- java | | `-- python | |-- io | |-- stubs | |-- testdata | `-- testing `-- solaris I figure that by doing it this way, the Windows guys can just open my Qt project file, and compile the whole application (including protobuf) with the same mingw compiler. Any hints? Thanks Bart van Deenen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---