It looks like you have a version mismatch between libprotobuf.so and protoc.
 Type:

  protoc --version

I think you will find that it prints a much older version than what you
expect.

I suspect that the problem is that you already had an older version of
protobuf installed (probably in /usr), and then you installed a newer
version into a different location (probably /usr/local).  pkg-config is
producing the correct flags to link against the new version, but when you
simply run "protoc" it's finding the old binary.

On Wed, Mar 17, 2010 at 10:37 PM, Nag <ysgnagen...@gmail.com> wrote:

> Hi,
>
> This is the error when i run the example code (address book)
>
> [ph...@localhost examples]$ make cpp
> pkg-config --cflags protobuf  # fails if protobuf is not installed
> -pthread
> c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --
> cflags --libs protobuf` -lprotobuf -lprotoc
> /tmp/ccyavNPd.o: In function
> `tutorial::protobuf_BuildDesc_addressbook_2eproto()':
> addressbook.pb.cc:(.text+0x1300): undefined reference to
> `google::protobuf::DescriptorPool::InternalBuildGeneratedFile(void
> const*, int)'
> addressbook.pb.cc:(.text+0x1382): undefined reference to
>
> `google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor
> const*, google::protobuf::Message const*, int const*, int, int, int,
> google::protobuf::DescriptorPool const*)'
> addressbook.pb.cc:(.text+0x140b): undefined reference to
>
> `google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor
> const*, google::protobuf::Message const*, int const*, int, int, int,
> google::protobuf::DescriptorPool const*)'
> addressbook.pb.cc:(.text+0x1504): undefined reference to
>
> `google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google::protobuf::Descriptor
> const*, google::protobuf::Message const*, int const*, int, int, int,
> google::protobuf::DescriptorPool const*)'
> /tmp/ccyavNPd.o: In function
> `google::protobuf::internal::GenericRepeatedField::GenericRepeatedField()':
> addressbook.pb.cc:
>
> (.text._ZN6google8protobuf8internal20GenericRepeatedFieldC2Ev[google::protobuf::internal::GenericRepeatedField::GenericRepeatedField()]
> +0x8): undefined reference to `vtable for
> google::protobuf::internal::GenericRepeatedField'
> /tmp/ccyavNPd.o: In function
>
> `google::protobuf::RepeatedPtrField<tutorial::Person>::~RepeatedPtrField()':
> addressbook.pb.cc:
>
> (.text._ZN6google8protobuf16RepeatedPtrFieldIN8tutorial6PersonEED1Ev[google::protobuf::RepeatedPtrField<tutorial::Person>::~RepeatedPtrField()]
> +0xa1): undefined reference to
> `google::protobuf::internal::GenericRepeatedField::~GenericRepeatedField()'
> addressbook.pb.cc:
>
> (.text._ZN6google8protobuf16RepeatedPtrFieldIN8tutorial6PersonEED1Ev[google::protobuf::RepeatedPtrField<tutorial::Person>::~RepeatedPtrField()]
> +0xc5): undefined reference to
> `google::protobuf::internal::GenericRepeatedField::~GenericRepeatedField()'
> /tmp/ccyavNPd.o: In function
>
> `google::protobuf::RepeatedPtrField<tutorial::Person>::~RepeatedPtrField()':
> addressbook.pb.cc:
>
> (.text._ZN6google8protobuf16RepeatedPtrFieldIN8tutorial6PersonEED0Ev[google::protobuf::RepeatedPtrField<tutorial::Person>::~RepeatedPtrField()]
> +0xa1): undefined reference to
> `google::protobuf::internal::GenericRepeatedField::~GenericRepeatedField()'
> addressbook.pb.cc:
>
> (.text._ZN6google8protobuf16RepeatedPtrFieldIN8tutorial6PersonEED0Ev[google::protobuf::RepeatedPtrField<tutorial::Person>::~RepeatedPtrField()]
> +0xc5): undefined reference to
> `google::protobuf::internal::GenericRepeatedField::~GenericRepeatedField()'
> /tmp/ccyavNPd.o: In function
>
> `google::protobuf::RepeatedPtrField<tutorial::Person_PhoneNumber>::~RepeatedPtrField()':
> addressbook.pb.cc:
>
> (.text._ZN6google8protobuf16RepeatedPtrFieldIN8tutorial18Person_PhoneNumberEED1Ev[google::protobuf::RepeatedPtrField<tutorial::Person_PhoneNumber>::~RepeatedPtrField()]
> +0xa1): undefined reference to
> `google::protobuf::internal::GenericRepeatedField::~GenericRepeatedField()'
> /tmp/ccyavNPd.o:addressbook.pb.cc:
>
> (.text._ZN6google8protobuf16RepeatedPtrFieldIN8tutorial18Person_PhoneNumberEED1Ev[google::protobuf::RepeatedPtrField<tutorial::Person_PhoneNumber>::~RepeatedPtrField()]
> +0xc5): more undefined references to
> `google::protobuf::internal::GenericRepeatedField::~GenericRepeatedField()'
> follow
> /tmp/ccyavNPd.o:
>
> (.rodata._ZTIN6google8protobuf16RepeatedPtrFieldIN8tutorial6PersonEEE[typeinfo
> for google::protobuf::RepeatedPtrField<tutorial::Person>]+0x8):
> undefined reference to `typeinfo for
> google::protobuf::internal::GenericRepeatedField'
> /tmp/ccyavNPd.o:
>
> (.rodata._ZTIN6google8protobuf16RepeatedPtrFieldIN8tutorial18Person_PhoneNumberEEE[typeinfo
> for google::protobuf::RepeatedPtrField<tutorial::Person_PhoneNumber>]
> +0x8): undefined reference to `typeinfo for
> google::protobuf::internal::GenericRepeatedField'
> collect2: ld returned 1 exit status
> make: *** [add_person_cpp] Error 1
>
>
>
>
> Any one Please help me, i am trying from 1 week.
> Please.....
>
> --
> 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<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

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

Reply via email to