Re: Using CopyingOutputStreamAdaptor and CodedOutputStream
No, that doesn't make sense. I need to see the exact code, from the point where the CodedOutputStream is constructed until it is destroyed. On Mon, Jun 29, 2009 at 5:35 PM, Kenton Varda wrote: > Odd. By any chance, does this only happen when writing a zero-length > message? > > > On Mon, Jun 29, 2009 at 5:22 PM, Alex Black wrote: > >> Error: >> >> libprotobuf FATAL ..\src\google\protobuf\io\zero_copy_stream_impl.cc:377] >> CHECK >> failed: buffer_used_ == buffer_size_: BackUp() can only be called after >> Next(). >> >> Stack trace: >> >> msvcr90d.dll!_NMSG_WRITE(int rterrnum=10) Line 198 C >> msvcr90d.dll!abort() Line 68 C >> GraphPerf.exe!google::protobuf::internal::LogMessage::Finish() Line >> 173 C++ >> >> GraphPerf.exe!google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage >> & other={...}) Line 177 C++ >> GraphPerf.exe!google::protobuf::io::CopyingOutputStreamAdaptor::BackUp(int >> count=2202) Line 378 + 0xa0 bytes C++ >> GraphPerf.exe!google::protobuf::io::CodedOutputStream::~CodedOutputStream() >> Line 526 C++ >> GraphPerf.exe!ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor() Line 10 + >> 0x59 bytes C++ >> >> -- >> *From:* Kenton Varda [mailto:ken...@google.com] >> *Sent:* Monday, June 29, 2009 7:08 PM >> *To:* Alex Black >> *Cc:* Protocol Buffers >> *Subject:* Re: Using CopyingOutputStreamAdaptor and CodedOutputStream >> >> >> >> On Sun, Jun 28, 2009 at 7:30 AM, Alex Black wrote: >> >>> >>> Hi, I'm trying to use these to serialize messages to my own stream. >>> >>> I have a couple of questions: >>> >>> 1. If I use message.SerializeToCodedStream() do I still need to write >>> the size of the message to the stream on my own first? >> >> >> Yes. >> >> >>> 2. My new code looks like this: >>> >>> MyStream myStream; // this implements CopyingOutputStream >>> CopyingOutputStreamAdaptor protoBufStream(&myStream); >>> CodedOutputStream codedOutputStream(&protoBufStream); >>> >>> Then I write messages like this: >>> >>> message.SerializeToCodedStream(&codedOutputStream); >>> >>> When the CodedOutputStream's destructor gets called, my program aborts >>> hard.. Looks like there is still 5192 bytes in its buffer, and I think >>> I need to call Flush() on it, but there is no flush? >> >> >> What is the error message? Stack trace? >> >> >>> >>> >>> thx >>> >>> - Alex >>> >>> >>> >>> >>> >> > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Using CopyingOutputStreamAdaptor and CodedOutputStream
Odd. By any chance, does this only happen when writing a zero-length message? On Mon, Jun 29, 2009 at 5:22 PM, Alex Black wrote: > Error: > > libprotobuf FATAL ..\src\google\protobuf\io\zero_copy_stream_impl.cc:377] > CHECK > failed: buffer_used_ == buffer_size_: BackUp() can only be called after > Next(). > > Stack trace: > > msvcr90d.dll!_NMSG_WRITE(int rterrnum=10) Line 198 C > msvcr90d.dll!abort() Line 68 C > GraphPerf.exe!google::protobuf::internal::LogMessage::Finish() Line > 173 C++ > > GraphPerf.exe!google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage > & other={...}) Line 177 C++ > GraphPerf.exe!google::protobuf::io::CopyingOutputStreamAdaptor::BackUp(int > count=2202) Line 378 + 0xa0 bytes C++ > GraphPerf.exe!google::protobuf::io::CodedOutputStream::~CodedOutputStream() > Line 526 C++ > GraphPerf.exe!ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor() Line 10 + > 0x59 bytes C++ > > -- > *From:* Kenton Varda [mailto:ken...@google.com] > *Sent:* Monday, June 29, 2009 7:08 PM > *To:* Alex Black > *Cc:* Protocol Buffers > *Subject:* Re: Using CopyingOutputStreamAdaptor and CodedOutputStream > > > > On Sun, Jun 28, 2009 at 7:30 AM, Alex Black wrote: > >> >> Hi, I'm trying to use these to serialize messages to my own stream. >> >> I have a couple of questions: >> >> 1. If I use message.SerializeToCodedStream() do I still need to write >> the size of the message to the stream on my own first? > > > Yes. > > >> 2. My new code looks like this: >> >> MyStream myStream; // this implements CopyingOutputStream >> CopyingOutputStreamAdaptor protoBufStream(&myStream); >> CodedOutputStream codedOutputStream(&protoBufStream); >> >> Then I write messages like this: >> >> message.SerializeToCodedStream(&codedOutputStream); >> >> When the CodedOutputStream's destructor gets called, my program aborts >> hard.. Looks like there is still 5192 bytes in its buffer, and I think >> I need to call Flush() on it, but there is no flush? > > > What is the error message? Stack trace? > > >> >> >> thx >> >> - Alex >> >> >> >> >> > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
RE: Using CopyingOutputStreamAdaptor and CodedOutputStream
Error: libprotobuf FATAL ..\src\google\protobuf\io\zero_copy_stream_impl.cc:377] CHECK failed: buffer_used_ == buffer_size_: BackUp() can only be called after Next(). Stack trace: msvcr90d.dll!_NMSG_WRITE(int rterrnum=10) Line 198 C msvcr90d.dll!abort() Line 68 C GraphPerf.exe!google::protobuf::internal::LogMessage::Finish() Line 173 C++ GraphPerf.exe!google::protobuf::internal::LogFinisher::operator=(google: :protobuf::internal::LogMessage & other={...}) Line 177 C++ GraphPerf.exe!google::protobuf::io::CopyingOutputStreamAdaptor::BackUp(i nt count=2202) Line 378 + 0xa0 bytes C++ GraphPerf.exe!google::protobuf::io::CodedOutputStream::~CodedOutputStrea m() Line 526 C++ GraphPerf.exe!ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor() Line 10 + 0x59 bytes C++ From: Kenton Varda [mailto:ken...@google.com] Sent: Monday, June 29, 2009 7:08 PM To: Alex Black Cc: Protocol Buffers Subject: Re: Using CopyingOutputStreamAdaptor and CodedOutputStream On Sun, Jun 28, 2009 at 7:30 AM, Alex Black wrote: Hi, I'm trying to use these to serialize messages to my own stream. I have a couple of questions: 1. If I use message.SerializeToCodedStream() do I still need to write the size of the message to the stream on my own first? Yes. 2. My new code looks like this: MyStream myStream; // this implements CopyingOutputStream CopyingOutputStreamAdaptor protoBufStream(&myStream); CodedOutputStream codedOutputStream(&protoBufStream); Then I write messages like this: message.SerializeToCodedStream(&codedOutputStream); When the CodedOutputStream's destructor gets called, my program aborts hard.. Looks like there is still 5192 bytes in its buffer, and I think I need to call Flush() on it, but there is no flush? What is the error message? Stack trace? thx - Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Using CopyingOutputStreamAdaptor and CodedOutputStream
On Sun, Jun 28, 2009 at 7:30 AM, Alex Black wrote: > > Hi, I'm trying to use these to serialize messages to my own stream. > > I have a couple of questions: > > 1. If I use message.SerializeToCodedStream() do I still need to write > the size of the message to the stream on my own first? Yes. > 2. My new code looks like this: > > MyStream myStream; // this implements CopyingOutputStream > CopyingOutputStreamAdaptor protoBufStream(&myStream); > CodedOutputStream codedOutputStream(&protoBufStream); > > Then I write messages like this: > > message.SerializeToCodedStream(&codedOutputStream); > > When the CodedOutputStream's destructor gets called, my program aborts > hard.. Looks like there is still 5192 bytes in its buffer, and I think > I need to call Flush() on it, but there is no flush? What is the error message? Stack trace? > > > thx > > - Alex > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: complite ERROR
You need to include zero_copy_stream_impl.h for FileOutputStream. You also have an extra & in front of coded_stream which shouldn't be there, since coded_stream is already a pointer. On Mon, Jun 29, 2009 at 1:56 AM, tong cao wrote: > > When I chenge some codes from the example,I have had the following > errors: > > My purpose is send data from socket. > > --- > 3 #include > 4 #include > 5 using namespace google::protobuf::io; > 6 > 7 #include > 8 #include > 9 #include > 10 #include > 11 #include > 12 > 13 #include > 14 #include > 15 #include > 16 #include "addressbook.pb.h" > 17 using namespace std; > .. > 95 int sock = socket(AF_INET,SOCK_STREAM,0); > 96 struct sockaddr_in add; > 97 add.sin_family = AF_INET; > 98 add.sin_addr.s_addr = inet_addr("127.0.0.1"); > 99 add.sin_port = 9000; > 100 bind(sock,(struct sockaddr*)&add,sizeof(add)); > 101 ZeroCopyOutputStream* raw_output = new FileOutputStream > (sock,-1); > 102 CodedOutputStream* coded_output = new CodedOutputStream > (raw_output); > 103 > 104 //if (!address_book.SerializeToOstream(&output)) { > 105 if (!address_book.SerializeToCodedStream(&coded_output)) { > 106 cerr << "Failed to write address book." << endl; > 107 return -1; > 108 } > . > > [r...@localhost examples]# make cpp > c++ add_person.cc addressbook.pb.cc -lprotobuf -lpthread -o > add_person_cpp > add_person.cc: In function ‘int main(int, char**)’: > add_person.cc:101: error: expected type-specifier before > ‘FileOutputStream’ > add_person.cc:101: error: cannot convert ‘int*’ to > ‘google::protobuf::io::ZeroCopyOutputStream*’ in initialization > add_person.cc:101: error: expected ‘,’ or ‘;’ before > ‘FileOutputStream’ > add_person.cc:105: error: no matching function for call to > ‘tutorial::AddressBook::SerializeToCodedStream > (google::protobuf::io::CodedOutputStream**)’ > /usr/local/include/google/protobuf/message.h:313: note: candidates > are: bool google::protobuf::Message::SerializeToCodedStream > (google::protobuf::io::CodedOutputStream*) const > make: *** [add_person_cpp] Error 1 > > > > > Why I get this error ,how can i fix it? Thanks, > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ProtocolBuffer crash before program execution
Sorry, I don't see what the problem could be. Make sure that you are compiling libprotobuf and your project with the same C runtime version (e.g. debug vs. non-debug, DLL vs. static, single-threaded vs. multi-threaded). If that doesn't help, can you send me a minimal example program that demonstrates the problem, so I can debug it? On Mon, Jun 29, 2009 at 5:45 AM, rodrigob wrote: > > I have uploaded the crash screenshot with Protobug 2.1.0 at > > > http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash_210.jpg > > as you can see the error is very similar. > This problem is being a show stopper for us, any help will be greatly > appreciated... > > Regards, > rodrigob. > > On Jun 26, 9:25 pm, Kenton Varda wrote: > > The stack trace you provided looks like it is from v2.0.3. The > > initialization code changed drastically in 2.1.0 -- the method > > DescriptorPool::InternalBuildGeneratedFile no longer exists, for example. > > Can you provide a stack trace using 2.1.0? > > > > On Fri, Jun 26, 2009 at 8:07 AM, rodrigob >wrote: > > > > > > > > > Hello there, > > > I'm usually a linux developer, but I occasionally have to develop some > > > Windows applications. > > > > > I have a Gtk + Cairo + ProtocolBuffers that was ported to windows some > > > months ago without any problem. > > > > > Now I have a new one, with similar setup but a few more dependencies > > > (CGAL, RSVG and others). > > > > > After configuring the visual studio project and getting the code to > > > compile and link correctly the executable crashes miserably on a > > > ProtocolBuffers exception. > > > > > The crash details can be inspected at > > > > http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash.jpg > > > > > the weird thing is that the application crashes before ever entering > > > in the main, during some static elements initialization defined by > > > Protocol Buffer. > > > > > I used first protobuf 2.1.0 and then 2.0.3, both crash in the same > > > way. > > > > > Any idea of what is going on ? I know that Protobuf can work unders > > > VisualStudio, but this time it is not working for me... what could > > > cause this kind of crashes ? > > > > > The problem seems similar to > > > > >http://groups.google.com/group/protobuf/browse_thread/thread/f0f8108f. > .. > > > > > but the crash source is no the same. > > > > > I'm using Windows Xp and Visual Studio 2005. > > > > > Any help would be appreciated. > > > > > Regards, > > > rodrigob. > > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Service Factory?
Protocol Buffers does not include an RPC implementation, only abstract interfaces for one. ServiceDescriptor is useful for implementing your own RPC system on top of protocol buffers -- it allows you to define your services directly in the .proto file even though protocol buffers itself does not provide RPC. On Mon, Jun 29, 2009 at 10:15 AM, rthompson.dtisoft@gmail.com < rthompson.dtisoft@gmail.com> wrote: > > What can you do with a ServiceDescriptor? Is there a > DynamicServiceFactory similar to the DynamicMessageFactory where you > can instantiate a service when all you have is a ServiceDescriptor, or > some other equivalent way of doing it? > > Thanks! > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Thread-safe messages
Simply adding a mutex lock in every accessor wouldn't really make them thread-safe. Consider: if (my_message.has_foo()) { DoSomething(my_message.foo()); } This is not thread-safe if my_message can be modified in a separate thread *even if* each accessor locked a mutex, because "foo" could be cleared in another thread between the call to has_foo() and the call to foo(). Here's a more dangerous example: for (int i = 0; i < my_message.foo_size(); i++) { DoSomething(my_message.foo(i); } Here, if "foo" is cleared between the call to foo_size() and the call to foo(i), then the program will crash. Having a mutex protecting each individual accessor does not help. Another problem is that strings are returned by reference. So even if the accessor itself locks a mutex, the string's contents may be accessed after the accessor returns, and if they are simultaneously modified in another thread you'll get a crash. What you really need to do is maintain your own mutex at a higher level. Any thread which reads the message object needs to take out a reader lock before it starts reading and hold that lock until it is completely done accessing the object. Similarly, any thread writing to a message object needs to take a writer lock on that mutex at a higher level. The protobuf library can't really do anything to help here, since the correct mutex usage depends entirely on your application code. On Mon, Jun 29, 2009 at 10:01 AM, Jes wrote: > > Hi everybody, > > we are working on a distributed environment that uses PB, where > different threads will access to the contents of messages that can be > updated at any moment through the network. > > I wonder if there is an easy way to transform the (derived) Messages > into a thread-safe version. Maybe the rough solution could be to > include a Mutex in the Message class and a MutexLock on each method of > the generated pb.h and pb.cc classes, but perhaps there are issues > that can break the safety of this approach (such as existing friends > or similar). > > Could you have any suggestion on this? :-) > > Thanks in advance! > > Jes > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Thread-safe messages
I'd recommend using an atomic swap to do your updates. So you create your new version of the PB localy, and then swap it in to the memory location that is visible to all the other threads. The only real downside is you stress the heap more, and that is probably cheaper/simpler (particularly if you want the updates to be transactional) than using extensive locking. --Chris On Mon, 2009-06-29 at 10:07 -0700, Jes wrote: > I forgot to mention that we are generating C++ code in the project. > > Jes > > On 29 jun, 19:01, Jes wrote: > > Hi everybody, > > > > we are working on a distributed environment that uses PB, where > > different threads will access to the contents of messages that can be > > updated at any moment through the network. > > > > I wonder if there is an easy way to transform the (derived) Messages > > into a thread-safe version. Maybe the rough solution could be to > > include a Mutex in the Message class and a MutexLock on each method of > > the generated pb.h and pb.cc classes, but perhaps there are issues > > that can break the safety of this approach (such as existing friends > > or similar). > > > > Could you have any suggestion on this? :-) > > > > Thanks in advance! > > > > Jes > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Service Factory?
What can you do with a ServiceDescriptor? Is there a DynamicServiceFactory similar to the DynamicMessageFactory where you can instantiate a service when all you have is a ServiceDescriptor, or some other equivalent way of doing it? Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Thread-safe messages
Hi everybody, we are working on a distributed environment that uses PB, where different threads will access to the contents of messages that can be updated at any moment through the network. I wonder if there is an easy way to transform the (derived) Messages into a thread-safe version. Maybe the rough solution could be to include a Mutex in the Message class and a MutexLock on each method of the generated pb.h and pb.cc classes, but perhaps there are issues that can break the safety of this approach (such as existing friends or similar). Could you have any suggestion on this? :-) Thanks in advance! Jes --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Thread-safe messages
I forgot to mention that we are generating C++ code in the project. Jes On 29 jun, 19:01, Jes wrote: > Hi everybody, > > we are working on a distributed environment that uses PB, where > different threads will access to the contents of messages that can be > updated at any moment through the network. > > I wonder if there is an easy way to transform the (derived) Messages > into a thread-safe version. Maybe the rough solution could be to > include a Mutex in the Message class and a MutexLock on each method of > the generated pb.h and pb.cc classes, but perhaps there are issues > that can break the safety of this approach (such as existing friends > or similar). > > Could you have any suggestion on this? :-) > > Thanks in advance! > > Jes --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ProtocolBuffer crash before program execution
I have uploaded the crash screenshot with Protobug 2.1.0 at http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash_210.jpg as you can see the error is very similar. This problem is being a show stopper for us, any help will be greatly appreciated... Regards, rodrigob. On Jun 26, 9:25 pm, Kenton Varda wrote: > The stack trace you provided looks like it is from v2.0.3. The > initialization code changed drastically in 2.1.0 -- the method > DescriptorPool::InternalBuildGeneratedFile no longer exists, for example. > Can you provide a stack trace using 2.1.0? > > On Fri, Jun 26, 2009 at 8:07 AM, rodrigob wrote: > > > > > Hello there, > > I'm usually a linux developer, but I occasionally have to develop some > > Windows applications. > > > I have a Gtk + Cairo + ProtocolBuffers that was ported to windows some > > months ago without any problem. > > > Now I have a new one, with similar setup but a few more dependencies > > (CGAL, RSVG and others). > > > After configuring the visual studio project and getting the code to > > compile and link correctly the executable crashes miserably on a > > ProtocolBuffers exception. > > > The crash details can be inspected at > >http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash.jpg > > > the weird thing is that the application crashes before ever entering > > in the main, during some static elements initialization defined by > > Protocol Buffer. > > > I used first protobuf 2.1.0 and then 2.0.3, both crash in the same > > way. > > > Any idea of what is going on ? I know that Protobuf can work unders > > VisualStudio, but this time it is not working for me... what could > > cause this kind of crashes ? > > > The problem seems similar to > > >http://groups.google.com/group/protobuf/browse_thread/thread/f0f8108f... > > > but the crash source is no the same. > > > I'm using Windows Xp and Visual Studio 2005. > > > Any help would be appreciated. > > > Regards, > > rodrigob. > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
complite ERROR
When I chenge some codes from the example,I have had the following errors: My purpose is send data from socket. --- 3 #include 4 #include 5 using namespace google::protobuf::io; 6 7 #include 8 #include 9 #include 10 #include 11 #include 12 13 #include 14 #include 15 #include 16 #include "addressbook.pb.h" 17 using namespace std; .. 95 int sock = socket(AF_INET,SOCK_STREAM,0); 96 struct sockaddr_in add; 97 add.sin_family = AF_INET; 98 add.sin_addr.s_addr = inet_addr("127.0.0.1"); 99 add.sin_port = 9000; 100 bind(sock,(struct sockaddr*)&add,sizeof(add)); 101 ZeroCopyOutputStream* raw_output = new FileOutputStream (sock,-1); 102 CodedOutputStream* coded_output = new CodedOutputStream (raw_output); 103 104 //if (!address_book.SerializeToOstream(&output)) { 105 if (!address_book.SerializeToCodedStream(&coded_output)) { 106 cerr << "Failed to write address book." << endl; 107 return -1; 108 } . [r...@localhost examples]# make cpp c++ add_person.cc addressbook.pb.cc -lprotobuf -lpthread -o add_person_cpp add_person.cc: In function ‘int main(int, char**)’: add_person.cc:101: error: expected type-specifier before ‘FileOutputStream’ add_person.cc:101: error: cannot convert ‘int*’ to ‘google::protobuf::io::ZeroCopyOutputStream*’ in initialization add_person.cc:101: error: expected ‘,’ or ‘;’ before ‘FileOutputStream’ add_person.cc:105: error: no matching function for call to ‘tutorial::AddressBook::SerializeToCodedStream (google::protobuf::io::CodedOutputStream**)’ /usr/local/include/google/protobuf/message.h:313: note: candidates are: bool google::protobuf::Message::SerializeToCodedStream (google::protobuf::io::CodedOutputStream*) const make: *** [add_person_cpp] Error 1 Why I get this error ,how can i fix it? Thanks, --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---