From: Fred Read Date: April 13 1999 3:29pm Subject: Re: Fw: mysql: problems with CGIs written in C and mysql List-Archive: http://lists.mysql.com/mysql/1776 Message-Id: <371362F0.6448FADC@corp.netcom.net.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tavaris Thomas wrote: > > Can anyone please advise? > > >I have since re-instralled a new version of MySQL 3.22.20a > >and the compiler is egcs 1.1.2 > >Sun ULTRA 1 using Solaris 2.6 > > > >I copied the file > > > >libmysqlclient.a (this is the client library file right?) > > > >into /usr/local/lib and /usr/lib > > > >Here is my new error when I compile (everything is on one line) > > > > > > gcc -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -o test > > test.c > > > >test.c: In function `main': > >test.c:29: warning: return type of `main' is not `int' > >Undefined first referenced > > symbol in file > >mysql_close /var/tmp/cc8KvfIk.o > >mysql_real_connect /var/tmp/cc8KvfIk.o > >mysql_init /var/tmp/cc8KvfIk.o > >ld: fatal: Symbol referencing errors. No output written to test > >collect2: ld returned 1 exit status You're almost there. You've told it where to look for the libraries but not which libraries to search! Adding "-lmysqlclient" [without the quotes] to the command line should fix it. Incidentally, I would fix the compiler warning also. It is a policy of mine not to run any program unless it compiles 100% cleanly with "all" compiler warnings enabled [-Wall]. I do this because it is far too easy to become complacent and say: "it doesn't matter, it's only a warning. If it was really important they would have made it an error" If it's worth their while telling you about it it's worth your while fixing it! Hope this helps... -- If it ain't opinionated, it ain't Rich Teer.