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.
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.