Kenton,

Thank you.

It prints 'libprotoc 2.3.0'. And I have setup my LD_LIBRARY_PATH,
PATH, PKG_CONFIG_PATH on my ubuntu env accordingly.

$ protoc --version
libprotoc 2.3.0
/media/EXTDIV/src/protobuf-2.3.0/examples:1014:14$ make cpp
pkg-config --cflags protobuf  # fails if protobuf is not installed
-pthread -I/media/EXTDIV/bin/include
c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config
--cflags --libs protobuf`
In file included from add_person.cc:6:
addressbook.pb.h:16:2: error: #error This file was generated by an
older version of protoc which is
addressbook.pb.h:17:2: error: #error incompatible with your Protocol
Buffer headers. Please
addressbook.pb.h:18:2: error: #error regenerate this file with a newer
version of protoc.
add_person.cc: In function ‘int main(int, char**)’:
add_person.cc:66: error: cannot declare variable ‘address_book’ to be
of abstract type ‘tutorial::AddressBook’
addressbook.pb.h:246: note:   because the following virtual functions
are pure within ‘tutorial::AddressBook’:
/media/EXTDIV/bin/include/google/protobuf/message.h:331: note:
       virtual google::protobuf::Metadata
google::protobuf::Message::GetMetadata() const
In file included from
/media/EXTDIV/bin/include/google/protobuf/unknown_field_set.h:43,
                from
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:44,
                from addressbook.pb.h:21,
                from add_person.cc:6:
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h: In static
member function ‘static GenericType*
google::protobuf::internal::GenericTypeHandler<GenericType>::New()
[with GenericType = tutorial::Person_PhoneNumber]’:
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:655:
instantiated from ‘typename TypeHandler::Type*
google::protobuf::internal::RepeatedPtrFieldBase::Add() [with
TypeHandler = 
google::protobuf::RepeatedPtrField<tutorial::Person_PhoneNumber>::TypeHandler]’
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:829:
instantiated from ‘Element*
google::protobuf::RepeatedPtrField<Element>::Add() [with Element =
tutorial::Person_PhoneNumber]’
addressbook.pb.h:491:   instantiated from here
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:271: error:
cannot allocate an object of abstract type
‘tutorial::Person_PhoneNumber’
addressbook.pb.h:48: note:   because the following virtual functions
are pure within ‘tutorial::Person_PhoneNumber’:
/media/EXTDIV/bin/include/google/protobuf/message.h:331: note:
       virtual google::protobuf::Metadata
google::protobuf::Message::GetMetadata() const
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h: In static
member function ‘static GenericType*
google::protobuf::internal::GenericTypeHandler<GenericType>::New()
[with GenericType = tutorial::Person]’:
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:655:
instantiated from ‘typename TypeHandler::Type*
google::protobuf::internal::RepeatedPtrFieldBase::Add() [with
TypeHandler = 
google::protobuf::RepeatedPtrField<tutorial::Person>::TypeHandler]’
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:829:
instantiated from ‘Element*
google::protobuf::RepeatedPtrField<Element>::Add() [with Element =
tutorial::Person]’
addressbook.pb.h:520:   instantiated from here
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:271: error:
cannot allocate an object of abstract type ‘tutorial::Person’
addressbook.pb.h:128: note:   because the following virtual functions
are pure within ‘tutorial::Person’:
/media/EXTDIV/bin/include/google/protobuf/message.h:331: note:
       virtual google::protobuf::Metadata
google::protobuf::Message::GetMetadata() const
In file included from addressbook.pb.cc:3:
addressbook.pb.h:16:2: error: #error This file was generated by an
older version of protoc which is
addressbook.pb.h:17:2: error: #error incompatible with your Protocol
Buffer headers. Please
addressbook.pb.h:18:2: error: #error regenerate this file with a newer
version of protoc.
addressbook.pb.cc:7:45: error: google/protobuf/wire_format_inl.h: No
such file or directory
addressbook.pb.cc: In function ‘void
tutorial::protobuf_BuildDesc_addressbook_2eproto_AssignGlobalDescriptors(const
google::protobuf::FileDescriptor*)’:
addressbook.pb.cc:29: error: cannot allocate an object of abstract
type ‘tutorial::Person’
addressbook.pb.h:128: note:   because the following virtual functions
are pure within ‘tutorial::Person’:
/media/EXTDIV/bin/include/google/protobuf/message.h:331: note:
       virtual google::protobuf::Metadata
google::protobuf::Message::GetMetadata() const
addressbook.pb.cc:45: error: no matching function for call to
‘google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::Descriptor*&, tutorial::Person*&, const int [4],
int, int, int, const google::protobuf::DescriptorPool*, unsigned int)’
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:344:
note: candidates are:
google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::internal::GeneratedMessageReflection&)
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:122:
note:
google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::Descriptor*, const google::protobuf::Message*, const
int*, int, int, int, const google::protobuf::DescriptorPool*,
google::protobuf::MessageFactory*, int)
addressbook.pb.cc:47: error: cannot allocate an object of abstract
type ‘tutorial::Person_PhoneNumber’
addressbook.pb.h:48: note:   because the following virtual functions
are pure within ‘tutorial::Person_PhoneNumber’:
/media/EXTDIV/bin/include/google/protobuf/message.h:331: note:
       virtual google::protobuf::Metadata
google::protobuf::Message::GetMetadata() const
addressbook.pb.cc:61: error: no matching function for call to
‘google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::Descriptor*&, tutorial::Person_PhoneNumber*&, const
int [2], int, int, int, const google::protobuf::DescriptorPool*,
unsigned int)’
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:344:
note: candidates are:
google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::internal::GeneratedMessageReflection&)
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:122:
note:
google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::Descriptor*, const google::protobuf::Message*, const
int*, int, int, int, const google::protobuf::DescriptorPool*,
google::protobuf::MessageFactory*, int)
addressbook.pb.cc:68: error: cannot allocate an object of abstract
type ‘tutorial::AddressBook’
addressbook.pb.h:246: note:   because the following virtual functions
are pure within ‘tutorial::AddressBook’:
/media/EXTDIV/bin/include/google/protobuf/message.h:331: note:
       virtual google::protobuf::Metadata
google::protobuf::Message::GetMetadata() const
addressbook.pb.cc:81: error: no matching function for call to
‘google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::Descriptor*&, tutorial::AddressBook*&, const int
[1], int, int, int, const google::protobuf::DescriptorPool*, unsigned
int)’
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:344:
note: candidates are:
google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::internal::GeneratedMessageReflection&)
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:122:
note:
google::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(const
google::protobuf::Descriptor*, const google::protobuf::Message*, const
int*, int, int, int, const google::protobuf::DescriptorPool*,
google::protobuf::MessageFactory*, int)
addressbook.pb.cc: In function ‘void
tutorial::protobuf_BuildDesc_addressbook_2eproto()’:
addressbook.pb.cc:97: error: ‘class google::protobuf::DescriptorPool’
has no member named ‘InternalBuildGeneratedFile’
addressbook.pb.cc: In member function ‘virtual
tutorial::Person_PhoneNumber* tutorial::Person_PhoneNumber::New()
const’:
addressbook.pb.cc:184: error: cannot allocate an object of abstract
type ‘tutorial::Person_PhoneNumber’
addressbook.pb.h:48: note:   since type ‘tutorial::Person_PhoneNumber’
has pure virtual functions
addressbook.pb.cc: In member function ‘virtual tutorial::Person*
tutorial::Person::New() const’:
addressbook.pb.cc:247: error: cannot allocate an object of abstract
type ‘tutorial::Person’
addressbook.pb.h:128: note:   since type ‘tutorial::Person’ has pure
virtual functions
addressbook.pb.cc: In member function ‘virtual tutorial::AddressBook*
tutorial::AddressBook::New() const’:
addressbook.pb.cc:295: error: cannot allocate an object of abstract
type ‘tutorial::AddressBook’
addressbook.pb.h:246: note:   since type ‘tutorial::AddressBook’ has
pure virtual functions
In file included from
/media/EXTDIV/bin/include/google/protobuf/unknown_field_set.h:43,
                from
/media/EXTDIV/bin/include/google/protobuf/generated_message_reflection.h:44,
                from addressbook.pb.h:21,
                from addressbook.pb.cc:3:
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h: In static
member function ‘static GenericType*
google::protobuf::internal::GenericTypeHandler<GenericType>::New()
[with GenericType = tutorial::Person_PhoneNumber]’:
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:655:
instantiated from ‘typename TypeHandler::Type*
google::protobuf::internal::RepeatedPtrFieldBase::Add() [with
TypeHandler = 
google::protobuf::RepeatedPtrField<tutorial::Person_PhoneNumber>::TypeHandler]’
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:829:
instantiated from ‘Element*
google::protobuf::RepeatedPtrField<Element>::Add() [with Element =
tutorial::Person_PhoneNumber]’
addressbook.pb.h:491:   instantiated from here
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:271: error:
cannot allocate an object of abstract type
‘tutorial::Person_PhoneNumber’
addressbook.pb.h:48: note:   since type ‘tutorial::Person_PhoneNumber’
has pure virtual functions
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h: In static
member function ‘static GenericType*
google::protobuf::internal::GenericTypeHandler<GenericType>::New()
[with GenericType = tutorial::Person]’:
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:655:
instantiated from ‘typename TypeHandler::Type*
google::protobuf::internal::RepeatedPtrFieldBase::Add() [with
TypeHandler = 
google::protobuf::RepeatedPtrField<tutorial::Person>::TypeHandler]’
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:829:
instantiated from ‘Element*
google::protobuf::RepeatedPtrField<Element>::Add() [with Element =
tutorial::Person]’
addressbook.pb.h:520:   instantiated from here
/media/EXTDIV/bin/include/google/protobuf/repeated_field.h:271: error:
cannot allocate an object of abstract type ‘tutorial::Person’
addressbook.pb.h:128: note:   since type ‘tutorial::Person’ has pure
virtual functions
make: *** [add_person_cpp] Error 1
/media/EXTDIV/src/protobuf-2.3.0/examples:1015:15$

On Tue, Feb 2, 2010 at 1:38 PM, Kenton Varda <ken...@google.com> wrote:
> What does "protoc --version" print?
>
> On Tue, Feb 2, 2010 at 10:31 AM, hap 497 <hap...@gmail.com> wrote:
>>
>> Hi,
>>
>> I am trying to compile protobuf cpp example.
>> $ cd /media/EXTDIV/src/protobuf-2.3.0/examples
>> $ make cpp
>>
>> But I am getting these errors:
>> c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config
>> --cflags --libs protobuf`
>> In file included from add_person.cc:6:
>> addressbook.pb.h:16:2: error: #error This file was generated by an
>> older version of protoc which is
>> addressbook.pb.h:17:2: error: #error incompatible with your Protocol
>> Buffer headers. Please
>> addressbook.pb.h:18:2: error: #error regenerate this file with a newer
>> version of protoc.
>> add_person.cc: In function ‘int main(int, char**)’:
>> add_person.cc:66: error: cannot declare variable ‘address_book’ to be
>> of abstract type ‘tutorial::AddressBook’
>> addressbook.pb.h:246: note:   because the following virtual functions
>> are pure within ‘tutorial::AddressBook’:
>>
>> I downnload the source tar ball 2.3.0 on Ubuntu. Is that out of date?
>>
>> Thank you.
>>
>> --
>> 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.
>>
>
> --
> 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.
>

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