When I chenge some codes from the example,I have had the following errors:
My purpose is send data from socket. ----------------------------------------------------------------------------------------------------------------------- 3 #include <google/protobuf/io/zero_copy_stream.h> 4 #include <google/protobuf/io/coded_stream.h> 5 using namespace google::protobuf::io; 6 7 #include <sys/types.h> 8 #include <sys/socket.h> 9 #include <netinet/in.h> 10 #include <arpa/inet.h> 11 #include <unistd.h> 12 13 #include <iostream> 14 #include <fstream> 15 #include <string> 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 -~----------~----~----~----~------~----~------~--~---