MySQL problem

Ing. Miloš Lesák lesak na uvn.sk
Pondělí Březen 15 15:09:13 CET 2004


Zdravim Vas.
Chcel by som Vas poprosit o radu.

Zkompiloval som MySQL verziu mysql-4.0.18.tar.gz nasledovne:

./configure
--prefix=/usr/local/mysql
--enable-assembler
--with-mysqld-ldflags=-all-static
--libdir=/usr/local/lib

Vsetko preslo v poriadku.
Mam napisany programik v C na autentifikaciu uzivatelov squida
ktory kompilujem nasledovnym sposobom:
gcc -L/usr/local/lib/mysql -I/usr/local/mysql/include -lmysqlclient -o sql_auth sql_auth.c

Cast kodu
---------------------------
#include <string.h>
#include <stdio.h>
#include <mysql/mysql.h>
#include <time.h>

#define SERVER "localhost"
#define SERVER_LOGIN ""
#define SERVER_PASS ""

int check_time( char *accessString );
int auth_ok( MYSQL *srvr, char *login, char *pass );

main()
{
 MYSQL auth_server, *retv=NULL;
 char *login, *pass, buff[256];

 retv = mysql_connect( &auth_server, SERVER, SERVER_LOGIN, SERVER_PASS );
 mysql_select_db( &auth_server, "uvnweb" );
 setbuf( stdout, NULL );

 while( fgets( buff, sizeof(buff), stdin ) )
  {
   login = strtok( buff, " \n" );
   pass = strtok( NULL, " \n" );

   if( auth_ok( &auth_server, login, pass ) )
    puts("OK");
   else
    puts("ERR");
  }
 mysql_close( &auth_server );
}
------------------------

Kompilacia konci chybou:
sql_auth.c: In function `main':
sql_auth.c:24: warning: assignment makes pointer from integer without a cast
/tmp/ccmLNjNq.o(.text+0x34): In function `main':
: undefined reference to `mysql_connect'
collect2: ld returned 1 exit status

Prosim o navigaciu.
Dakujem.



Další informace o konferenci Linux