I am using the protobuf-c extension out there. Getting the following errors:
gcc tut.c tut.pb-c.c -o tut -lprotobuf-c -lprotobuf -lpthread /tmp/ccBHwTBl.o: In function `main': tut.c:(.text+0xab): undefined reference to `a_message__get_packed_size' tut.c:(.text+0xcc): undefined reference to `a_message__pack' collect2: ld returned 1 exit status tut.c ---------------- #include "tut.pb- c.h" #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { AMessage msg = AMESSAGE__INIT; void *buf; unsigned len; if (argc < 2 || argc > 3) { fprintf(stderr, "usage: pack a [b] \n"); return 1; } msg.a = atoi(argv[1]); if (argc == 3) { msg.has_b = 1; msg.b = atoi(argv[2]); } len = a_message__get_packed_size(&msg); buf = malloc(len); a_message__pack(&msg, buf); fwrite(buf, len, 1, stdout); return 0; } tut-pb-c.h ------------------------------------------ /* Generated by the protocol buffer compiler. DO NOT EDIT! */ #ifndef PROTOBUF_C_tut_2eproto__INCLUDED #define PROTOBUF_C_tut_2eproto__INCLUDED #include <google/protobuf-c/protobuf-c.h> PROTOBUF_C_BEGIN_DECLS typedef struct _AMessage AMessage; /* --- enums --- */ /* --- messages --- */ struct _AMessage { ProtobufCMessage base; int32_t a; protobuf_c_boolean has_b; int32_t b; }; #define AMESSAGE__INIT \ { PROTOBUF_C_MESSAGE_INIT (&amessage__descriptor) \ , 0, 0,0 } /* AMessage methods */ void amessage__init (AMessage *message); size_t amessage__get_packed_size (const AMessage *message); size_t amessage__pack (const AMessage *message, uint8_t *out); size_t amessage__pack_to_buffer (const AMessage *message, ProtobufCBuffer *buffer); AMessage * amessage__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void amessage__free_unpacked (AMessage *message, ProtobufCAllocator *allocator); /* --- per-message closures --- */ typedef void (*AMessage_Closure) (const AMessage *message, void *closure_data); /* --- services --- */ /* --- descriptors --- */ extern const ProtobufCMessageDescriptor amessage__descriptor; PROTOBUF_C_END_DECLS #endif /* PROTOBUF_tut_2eproto__INCLUDED */ -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@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.