well, it's definitely in libmysqlclient.a:

> nm libmysqlclient.a | grep mysql_escape_string
000000000000370c T mysql_escape_string

Sometimes, link order does matter. try putting -lmysqlclient at the end.
you may also need -lm.


> -----Original Message-----
> From: Tom Whiting [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 16, 2002 7:35 PM
> To: [email protected]
> Subject: hmm
> 
> 
> This may seem like an apparent newbie question, and if it does I'm
> sorry. I've spent the past couple of hours trying to figure out how to
> actually get a mysql connection running on the game. Sadly it 
> compiles,
> up untill where the object files are linked in, then spits out the
> following:
> 
> /home/twhiting/beta/src/sql_stats.c:93: undefined reference to
> `mysql_escape_string'
> /home/twhiting/beta/src/sql_stats.c:96: undefined reference to
> `mysql_init'
> /home/twhiting/beta/src/sql_stats.c:110: undefined reference to
> `mysql_real_connect'
> /home/twhiting/beta/src/sql_stats.c:120: undefined reference to
> `mysql_real_query'
> /home/twhiting/beta/src/sql_stats.c:127: undefined reference to
> `mysql_store_result'
> /home/twhiting/beta/src/sql_stats.c:128: undefined reference to
> `mysql_num_rows'
> /home/twhiting/beta/src/sql_stats.c:136: undefined reference to
> `mysql_fetch_row'
> /home/twhiting/beta/src/sql_stats.c:212: undefined reference to
> `mysql_close'
> 
> 
> Now, I've got the following for a header/include in mysql_stats.c:
> 
> #include <mysql/mysql.h>
> #include "sql.h"
> #include "recycle.h"
> 
> In mysql/mysql.h, I've found the refs to mysql_close and all.
> 
> In the makefile:
> LIBS    = -lcrypt -lmysqlclient -lnsl -lnisam -lmysys -s
> L_FLAGS =  $(PROF)  $(LIBS) 
> LDFLAGS =  -L/usr/lib/mysql/ -I/usr/include/mysql/
> 
> 2k: $(2k_FILES)
>       rm -f 2k
>       $(CC)  -I$(INCLUDE) $(LDFLAGS) $(L_FLAGS)  -o 2k $(2k_FILES)
> 
> Obviously there's more to it, but I'm not going to include that for
> space and all.
> 
> The linking part of things:
> rm -f 2k
> gcc  -Iinclude -L/usr/lib/mysql/ -I/usr/include/mysql/ -O -ggdb
> -lcrypt -lmysqlclient -lnsl -lnisam -lmysys -s   -o 2k
> 
> When it comes to linking in libraries, I've got zero experience
> whatsoever. Can anyone see what I'm doing wrong in here? I'm stumped.
> 

Reply via email to