I've got the following file on RH Linux 7.0:

#include <mysql/mysql.h>
#include <stdio.h>

int main()
{
    MYSQL mysqlConnection;
    mysql_init(&mysqlConnection);

    mysql_options(&mysqlConnection,MYSQL_READ_DEFAULT_GROUP,"Finance Manager");

    if (!mysql_real_connect(&mysqlConnection,"localhost","root"
                            ,"1woodydogCONIFER2701Cmwb2diG"
                            ,"consulting",0,NULL,0))
    {

        fprintf(stderr, "Failed to connect to database: Error: %s\n",
                mysql_error(&mysqlConnection));
        
    }
    
    
}

********************************************************************
I compile it using:
gcc -L/usr/lib/mysql -lmysqlclient test.c
and get the error:
/tmp/cc2ymhI7.o: In function `main':
/tmp/cc2ymhI7.o(.text+0x14): undefined reference to `mysql_init'
/tmp/cc2ymhI7.o(.text+0x2d): undefined reference to `mysql_options'
/tmp/cc2ymhI7.o(.text+0x56): undefined reference to `mysql_real_connect'
/tmp/cc2ymhI7.o(.text+0x7a): undefined reference to `mysql_error'
collect2: ld returned 1 exit status

locate mysqlclient shows:
/usr/lib/mysql/libmysqlclient.so and .a and some others.

I've tried compiling as root, and it still does it...

I can do strings /usr/lib/mysql/libmysqlclient.a | grep mysql_init
and it shows up, but won't link...

Thanks for your help, and I"m not on the list, so please cc: [EMAIL PROTECTED]

Thanks
Mike B.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to