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]