From owner-freebsd-questions Thu Oct 15 02:03:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA25777 for freebsd-questions-outgoing; Thu, 15 Oct 1998 02:03:40 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from runner.jjsoft.com (jahanur.intur.net [206.97.149.64]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA25771 for ; Thu, 15 Oct 1998 02:03:33 -0700 (PDT) (envelope-from " jahan"@pc.jaring.my) Received: from pc.jaring.my (klj-17-126.tm.net.my [202.188.17.126]) by runner.jjsoft.com (8.9.0/8.9.0) with ESMTP id EAA18082 for ; Thu, 15 Oct 1998 04:03:11 -0500 (CDT) Message-ID: <36267F03.7AA1D180@pc.jaring.my> Date: Thu, 15 Oct 1998 16:02:27 -0700 From: Jahan <" jahan"@pc.jaring.my> Reply-To: jahan@pc.jaring.my X-Mailer: Mozilla 4.06 [en] (Win98; I) MIME-Version: 1.0 To: "freebsd-questions@FreeBSD.ORG" Subject: Re: Arg...Undefined symbol...error in C program References: <35C8FC5C.3AB72BE8@itw.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 > #include > > 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