If you use g++ in the final step(i.e. use 'g++ ./*.o -o main.out' instead), everything's OK. I don't know why gcc prompts such error. Zheng btw: you should include Connector.h in your main file, right? Otherwise it cannot be compiled. On Tue, 20 Jul 2004, Andre Kirchner wrote: >Hi, >I made this simple C++ program, but when I try to >compile it, gcc returns the followinf error message: > >gcc -c Connector.cpp >gcc -c main.cpp >gcc ./*.o -o main.out >./main.o(.eh_frame+0x11): undefined reference to >`__gxx_personality_v0' >collect2: ld returned 1 exit status >make: *** [main.out] Error 1 > >What is this undefined reference to >`__gxx_personality_v0, and how do I fix it? >The following is the code of main.cpp, Connecot.h and >Connector.cpp if it may help you to find the problem. > >Thanks a lot, > >Andre > >_________________________________________ >main.cpp: > >#ifndef MAIN ># define MAIN ># include "main.h" >#endif > >int main( int argc, char *argv[] ) >{ >// char theMessage[ 256 ]; > Connector theConnector; > > >// theConnector.connect( "mx1.hotmail.com", 25 ); >// theConnector.receiveMessage( theMessage, 255 ); > >// printf( "%s\n", theMessage ); > >// theConnector.disconnect; > > > > return ( EXIT_SUCESS ); >} >_________________________________________ >Connector.h: > >#define ERROR -1 >#define SUCCESS 0 > >#ifndef SOCKET ># define SOCKET ># include <sys/socket.h> >#endif > >#ifndef NETDB ># define NETDB ># include <netdb.h> >#endif > >#ifndef STRING ># define STRING ># include <string.h> >#endif > >#ifndef UNISTD ># define UNISTD ># include <unistd.h> >#endif > >class Connector >{ > public: > Connector(){}; > ~Connector(){}; > int connect( const char * theMailServerName, int >thePortNumber ); > int sendMessage( const char * theMessage ); > int receiveMessage( char * theMessage, int >theMessageLength ); > int disconnect(); > > private: > int sockfd; >}; >________________________________________ >Connector.cpp: > >#ifndef CONNECTOR ># define CONNECTOR ># include "Connector.h" >#endif > >int Connector::connect( const char * >theMailServerName, int thePortNumber ) >{ > struct sockaddr_in theMailServerAddress; > struct hostent * theMailServer; > > sockfd = socket( AF_INET, SOCK_STREAM, 0 ); > if( sockfd < 0 ) > return( ERROR ); > > theMailServer = gethostbyname( theMailServerName ); > if ( theMailServer == NULL ) > return( ERROR ); > > bzero( ( char *) &theMailServerAddress, sizeof( >theMailServerAddress ) ); > theMailServerAddress.sin_family = AF_INET; > bcopy( ( char *)theMailServer->h_addr, ( char >*)&theMailServerAddress.sin_addr.s_addr, >theMailServer->h_length ); > theMailServerAddress.sin_port = htons( thePortNumber >); > > return( SUCCESS ); >} > >int Connector::sendMessage( const char * theMessage ) >{ > if( send( sockfd, theMessage, strlen( theMessage ), 0 >) < 0 ) > return( ERROR ); > > return( SUCCESS ); >} > >int Connector::receiveMessage( char * theMessage, int >theMessageLength ) >{ > if( recv ( sockfd, theMessage, theMessageLength, 0) < >0 ) > return( ERROR ); > > return( SUCCESS ); >} > >int Connector::disconnect() >{ > if( close( sockfd ) < 0 ) > return( ERROR ); > > return( SUCCESS ); >} > > > > > > >__________________________________ >Do you Yahoo!? >New and Improved Yahoo! Mail - 100MB free storage! >http://promotions.yahoo.com/new_mail >