Hi Volnei, Under Linux you do not need the -lsocket. (If I recall correctly that is for SUN Solaris but I might be wrong)
As for your run-time error, the DLL libmysqlclient.so is not in the library path. Either modify /etc/ld.so.conf to include where is that library (it seems to be /usr/local/mysql/lib/mysql from your gcc command line). In which case do not forget to run ldconfig -n OR Set the environment variable LD_LIBRARY_PATH to where the library is installed (again from your gcc command line it seems to be /usr/local/mysql/lib/mysql). Regards, Bernard On Wednesday 25 February 2004 09:37, Galbino wrote: > Hello, > > I made a compilation test, to see how it works, and already the first > beginner problems came. > > #include <sys/time.h> > #include <stdio.h> > #include <mysql.h> > > int main(int argc, char *argv[]){ > MYSQL_RES *result; > MYSQL_ROW row; > MYSQL *connection, mysql; > int state; > /* Conectando com MySQL */ > printf("Iniciando o MySQL!!!"); > mysql_init(&mysql); > connection = > mysql_real_connect(&mysql,"localhost","root","mysql","banco",0,NULL,0); > if (connection == NULL){ > printf("Não conectado!!!"); > printf(mysql_error(&mysql)); > return 1; > } > /* Close connection */ > mysql_close(connection); > printf("\nSaindo! \n"); > } > > When I try to compile, with the command below, he says that cannot find > the "- lsocket." > Is the command correct? > Which the problem? > > [EMAIL PROTECTED] teste]# gcc -L/usr/local/mysql/lib/mysql > -I/usr/local/mysql/include/mysql -o teste teste.c -lmysqlclient -lnsl > -lsocket > /usr/bin/ld: cannot find -lsocket > collect2: ld returned 1 exit status > [EMAIL PROTECTED] teste]# > > Removing the command "- lsocket", the compilation is executed, however > when I will execute, appears the message, as shown below. > > [EMAIL PROTECTED] teste]# gcc -L/usr/local/mysql/lib/mysql > -I/usr/local/mysql/include/mysql -o teste teste.c -lmysqlclient -lnsl > [EMAIL PROTECTED] teste]# > > [EMAIL PROTECTED] teste]# ./teste > ./teste: error while loading shared libraries: libmysqlclient.so.14: > cannot open shared object file: No such file or directory > [EMAIL PROTECTED] teste]# > > what this happening? > > Volnei Galbino. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]