Description:
iam trying to compile the example client1.c of its book but I have problems this is what I do:
gcc -o Conex1 conex.c -I/usr/local/mysql/include/ -L/usr/local/mysql/lib/ -lmysqlclient
and appears this:
En el fichero incluĆdo de /usr/local/mysql/include/my_global.h:303,
de conex.c:1:
/usr/include/asm/atomic.h:40:2: aviso: #warning Using kernel header in userland program. BAD!
/usr/local/mysql/lib//libmysqlclient.a(my_compress.o): In function `my_compress_alloc':
my_compress.o(.text+0xb4): undefined reference to `compress'
/usr/local/mysql/lib//libmysqlclient.a(my_compress.o): In function `my_uncompress':
my_compress.o(.text+0x12a): undefined reference to `uncompress'
collect2: ld devolvió el estado de salida 1
this is code:
#include <my_global.h>
#include <mysql.h>
static char *opt_host_name = NULL; /* server host (default=localhost) */
static char *opt_user_name = NULL; /* username (default=login name) */
static char *opt_password = NULL; /* password (default=none) */
static unsigned int opt_port_num = 0; /* port number (use built-in value) */
static char *opt_socket_name = NULL; /* socket name (use built-in value) */
static char *opt_db_name = NULL; /* database name (default=none) */
static unsigned int opt_flags = 0; /* connection flags (none) */
static MYSQL *conn; /* pointer to connection handler */
int main (int argc, char *argv[])
{
/* initialize connection handler */
conn = mysql_init (NULL);
/* connect to server */
mysql_real_connect (conn, opt_host_name, opt_user_name, opt_password,
opt_db_name, opt_port_num, opt_socket_name, opt_flags);
/* disconnect from server */
mysql_close (conn);
exit (0);
}
How to repeat:
i dont know
Suggested fix:
i dont know
Description: iam trying to compile the example client1.c of its book but I have problems this is what I do: gcc -o Conex1 conex.c -I/usr/local/mysql/include/ -L/usr/local/mysql/lib/ -lmysqlclient and appears this: En el fichero incluĆdo de /usr/local/mysql/include/my_global.h:303, de conex.c:1: /usr/include/asm/atomic.h:40:2: aviso: #warning Using kernel header in userland program. BAD! /usr/local/mysql/lib//libmysqlclient.a(my_compress.o): In function `my_compress_alloc': my_compress.o(.text+0xb4): undefined reference to `compress' /usr/local/mysql/lib//libmysqlclient.a(my_compress.o): In function `my_uncompress': my_compress.o(.text+0x12a): undefined reference to `uncompress' collect2: ld devolvió el estado de salida 1 this is code: #include <my_global.h> #include <mysql.h> static char *opt_host_name = NULL; /* server host (default=localhost) */ static char *opt_user_name = NULL; /* username (default=login name) */ static char *opt_password = NULL; /* password (default=none) */ static unsigned int opt_port_num = 0; /* port number (use built-in value) */ static char *opt_socket_name = NULL; /* socket name (use built-in value) */ static char *opt_db_name = NULL; /* database name (default=none) */ static unsigned int opt_flags = 0; /* connection flags (none) */ static MYSQL *conn; /* pointer to connection handler */ int main (int argc, char *argv[]) { /* initialize connection handler */ conn = mysql_init (NULL); /* connect to server */ mysql_real_connect (conn, opt_host_name, opt_user_name, opt_password, opt_db_name, opt_port_num, opt_socket_name, opt_flags); /* disconnect from server */ mysql_close (conn); exit (0); } How to repeat: i dont know Suggested fix: i dont know