Protobuf-C Compilation Issue

I'm feeling a bit thick, but when I run through even basic examples provided on http://code.google.com/p/protobuf-c/wiki/Examples, I keep getting the following build errors:

/tmp/cc19catp.o: In function `main':
packit.c:(.text+0x13): undefined reference to `amessage__descriptor'
packit.c:(.text+0xb6): undefined reference to `amessage__get_packed_size'
packit.c:(.text+0xdb): undefined reference to `amessage__pack'
collect2: ld returned 1 exit status

I'm compiling with the following command:

gcc -o pack -lprotobuf-c packit.c

Anyone else have this problem? I feel I'm missing something basic.

Answers


gcc -o pack packit.c amessage.pb-c.c -lprotobuf-c

You must compile and link the proto-c-generated code.

Also, in general, when foo depends on bar, foo should precede bar in the linker command.


Need Your Help

generating non repeating random number in java

java

i am making a game which will ask different questions in java. questions are stored in some arraylist.

Javascript error when destroying Bootstrap popover

javascript jquery twitter-bootstrap popover

Trying to change on the go the title and content of a bootstrap Popover, I am having some trouble.