"Joshua T. McKee" wrote:
> Does anyone have any idea how to link the mysqlclient to your own
> programs? I've been trying to link this library into my program for the
> past 4 days without success. The diea is simple, however implementation
> proves very difficult.
> I'm trying to build a simple program (right now, just a connection to the
> database using mysql_real_connect), but I get the following error:
> Undefined first referenced
> symbol in file
> mysql_real_connect /var/tmp/ccyvMqM_1.o
> ld: fatal: Symbol referencing errors. No output written to db
> This happens with any function I attempt to call within the clinet
> library. I've tried it on Solaris 2.6 with GCC 2.8.1 and mySQL 3.21.33b
> and RedHat Linux 6.0 with mySQL 3.22.23b with similar results. The
> following is the compile line I use:
> gcc -o db -I/usr/local/include/mysql -L/usr/local/lib/mysql -lmysqlclient
> -lnsl -lm -lsocket db.c
> I've also added the "-static" option (on the Linux as it appears to link
> dynamically by default), I've rebuilt mySQL using the "--disable-shared"
> option. I've added /usr/local/lib/mysql to "LD_LIBRARY_PATH" and
> "LD_RUN_PATH" during my program compile and that of mySQL itself...no
> luck! In short, everything I can think of, yet it still refuses to link
> this library. Is there some black magic vodoo that I need to perform?
> As this is happening on two different systems, with two different
> versions, it has to be something I'm doing wrong. Yet I cannot determine
> what it is. Any help would be very much appreciated!
What's the output of
ls -l /usr/local/lib/mysql