How to install Protocol Buffers in Window?

5,952 views
Skip to first unread message

ndho...@gmail.com

unread,
Jul 30, 2008, 3:21:50 AM7/30/08
to Protocol Buffers
Dear all,

I am writing a socket application to transfer messages and I
consider Protocol Buffers as a solution to unify exchanged data.
I installed and tested it successfully in Linux and trying to
install in Window but I got in some problems:
- I successfully use ProtoBuf_Win32_Compiler to compile
*.proto file to *.h, *.pb.cc file but cannot compile them to *.exe
since lack of library files. Then I copied *.h, *.cc files from source
package to lib directory and recompile but it still throws some errors
such as: "`HASH_NAMESPACE' has not been declared" (in hash.h) etc.

- My second solution: I use Eclipse to build a static library
base on source package and also got the same problem.

Could you please show me the way to install and use ProtoBuf in
Window?

Thanks so much,
Hai Ngo

ndho...@gmail.com

unread,
Jul 30, 2008, 6:45:42 AM7/30/08
to Protocol Buffers
Dear all,

I have just built "libProtocolBuffer.a" successfully with some
errors in "gtest.h", "coded_stream_unittest.cc" and
"tokenizer_unittest.cc" :-) But at least, I can run the test
application base on this library (same as result on Linux).

To build this library, I follow below steps:
+ Copy source folder into my local pc (google and gtest
only).
+ Use protoc.exe (Win32) to compile "google\protobuf\*.proto"
files.
+ Copy "config.h" file on Linux (after installed
ProtocolBuffer) and replace it in my source folder.
+ Create static library project in Eclipse.
+ Then build project.

And here are some errors that I have not fixed yet:

+ instantiated from `static testing::AssertionResult
testing::internal::EqHelper< true>::Compare(const char*, const char*,
const T1&, const T2&) [with T1 = int, T2 = google::protobuf::uint64]'
==> In line: return CmpHelperEQ(expected_expression,
actual_expression, expected, actual); <<gtest.h>>

+ instantiated from `void
google::protobuf::io::<unnamed>::CodedStreamTest_WriteLittleEndian32_DD::DoSingleCase(const
CaseType1&, const CaseType2&) [with CaseType1 =
google::protobuf::io::<unnamed>::Fixed32Case, CaseType2 = int]'
==> In line: EXPECT_EQ(sizeof(uint32),
(int)coded_output.ByteCount()); <<coded_stream_unittest.cc>>

+ instantiated from `void
google::protobuf::io::<unnamed>::TokenizerTest_SimpleTokens_DD::DoSingleCase(const
CaseType1&, const CaseType2&) [with CaseType1 =
google::protobuf::io::<unnamed>::SimpleTokenCase, CaseType2 = int]'
==> Inline: EXPECT_EQ(kSimpleTokenCases_case.input.size(),
tokenizer.current().column); <<tokenizer_unittest.cc>>

Is there anyone that meet the same as my errors?
I welcome your comments.

Thanks and Best Regards,
Hai Ngo

Kenton Varda

unread,
Jul 30, 2008, 3:16:17 PM7/30/08
to ndho...@gmail.com, Protocol Buffers
What compiler are you using?  If you are using MSVC, please follow the instructions in vsprojects/readme.txt in order to compile and install protocol buffers on Windows.  If you are using Cygwin or MinGW, then you can install protocol buffers using the same instructions as you would use on Linux.  In the MinGW case, you will need to install MSYS (available from mingw.org) in order to run the configure script.  You should use the --prefix option to install to the MinGW directory, e.g.:

./configure --prefix=c:/mingw

ndho...@gmail.com

unread,
Jul 30, 2008, 11:53:16 PM7/30/08
to Protocol Buffers
Thank you for your soon reply,

But I am confused when you say that follow same instructions on Linux
to install on Window.
Example: First step is running 'configure' to configure settings and
then run 'make' to compile package. We cannot perform these 2 steps
since they are reserved for Linux system.

Currently, I am using Cygwin and Eclipse editor on Window XP.
Could you please explain more details about installing instructions
(some example steps)?

Best Regards,

Kenton Varda

unread,
Jul 31, 2008, 12:15:43 AM7/31/08
to ndho...@gmail.com, Protocol Buffers
On Wed, Jul 30, 2008 at 8:53 PM, <ndho...@gmail.com> wrote:
Example: First step is running 'configure' to configure settings and
then run 'make' to compile package. We cannot perform these 2 steps
since they are reserved for Linux system.

What do you mean, "they are reserved for Linux system"?
 
Currently, I am using Cygwin and Eclipse editor on Window XP.
Could you please explain more details about installing instructions
(some example steps)?

Yes.

1) Open a cygwin shell and change to the protobuf source directory.
2) Follow the instructions in README.txt (run configure, make check, make install).

ndho...@gmail.com

unread,
Jul 31, 2008, 12:39:16 AM7/31/08
to Protocol Buffers

I understood already. Thanks again for your support. Because I've
never use Cygwin shell before so that I don't understand your
answer :P

I wish Protocol Buffer will be better with your effort.
Reply all
Reply to author
Forward
0 new messages