On Thu, May 26, 2011 at 4:29 AM, lzhshen <lzhs...@gmail.com> wrote: > Take addressbook.proto as example, following command does not work: > > c++ addressbook.pb.cc -o addressbook.o `pkg-config --cflags > protobuf` > > Following are error output: > > /usr/lib64/gcc/x86_64-unknown-linux/4.1.2/../../../../lib64/crt1.o: In > function `_start': > (.text+0x20): undefined reference to `main' > /tmp/ccjvcDzQ.o: In function `tutorial::Person::SharedDtor()': > addressbook.pb.cc:(.text+0x64a): undefined reference to > `google::protobuf::internal::kEmptyString' > addressbook.pb.cc:(.text+0x67f): undefined reference to > `google::protobuf::internal::kEmptyString' > /tmp/ccjvcDzQ.o: In function > `tutorial::Person_PhoneNumber::SharedDtor()': > addressbook.pb.cc:(.text+0x6c2): undefined reference to > `google::protobuf::internal::kEmptyString' > /tmp/ccjvcDzQ.o: In function `tutorial::Person_PhoneNumber::ByteSize() > const': > > > Have any idea?
Yes, you tried to link the file into an executable instead of an object file, and the linker is complaining because it cannot find a valid main(), among many other functions. GCC requires the '-c' option to tell it to output an object file instead of an executable. Adam -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@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.