Date: Thu, 15 Oct 1998 16:02:27 -0700 From: Jahan <" jahan"@pc.jaring.my> To: "freebsd-questions@FreeBSD.ORG" <freebsd-questions@FreeBSD.ORG> Subject: Re: Arg...Undefined symbol...error in C program Message-ID: <36267F03.7AA1D180@pc.jaring.my> References: <35C8FC5C.3AB72BE8@itw.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Try this cc -I/usr/local/include/mysql -L/usr/local/lib/mysql $1.c -lm -lmysqlclient Mr Bill wrote: > > Hello again folks. This oughtta be easy, but then again...I'm trying to > use the MySQL C API to access a database. Seems easy enough. Here's a > (non-useful) program snippet: > > -------snibegin------ > #include <stdio.h> > #include <mysql.h> > > main() > { > MYSQL MySQL; > mysql_connect(&MySQL, "mrbill", "bill", "metekake"); > } /* main */ > -------sniend--------- > > The header file (mysql.h) has the declaration: > > MYSQL *mysql_connect(MYSQL *mysql, const char *host, > const char *user, const char *passwd); > I try, and get: > > MrBill:~/db/src$ cc -I/usr/local/include/mysql -L/usr/local/lib/mysql > -lmysqlclient tryme.c > /var/tmp/ccSBG4211.o: Undefined symbol `_mysql_connect' referenced > from text segment > > The MySQL docs say I need to add a -lm library as the last linked lib, > but that does not help. The compiler checks the mysql header, because > syntax or type errors halt compilation. The lib seems OK: > > MrBill:/usr/local/lib/mysql$ strings libmysqlclient.a | grep connect > _mysql_real_connect > _mysql_connect > _mysql_reconnect > _mysql_real_connect > _remember_connection > _mysql_connect > _connect > > This oughtta be easy. Have I lost my mind? > > Thanks > -Glen > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36267F03.7AA1D180>