Nick Gianakas wrote:
> Hi all,
>
> I just started learning mySQL yesterday. I'm using it for a web application
> (simple CGI stuff).
>
> To begin, I wrote a simple program that just initializes a mySQL connection
> and then closes it.
>
> Here's my problem:
> I'm getting compile errors when I link the libmysqlclient.a archive to my
> program.
>
> The compiler reports these errors:
> Undefined symbol first referenced in file
> socket ../mySQL/lib/libmysqlclient.a(libmysql.o)
> gethostbyname ../mySQL/lib/libmysqlclient.a(libmysql.o)
> setsockopt ../mySQL/lib/libmysqlclient.a(libmysql.o)
> getservbyname ../mySQL/lib/libmysqlclient.a(libmysql.o)
> floor ../mySQL/lib/libmysqlclient.a(password.o)
> getsockopt ../mySQL/lib/libmysqlclient.a(libmysql.o)
> inet_addr ../mySQL/lib/libmysqlclient.a(libmysql.o)
> shutdown ../mySQL/lib/libmysqlclient.a(libmysql.o)
> connect ../mySQL/lib/libmysqlclient.a(libmysql.o)
>
> I'm compiling using gcc as such:
> gcc test.c -o test.cgi ../mySQL/lib/libmysqlclient.a
>
> If I remove the archive, it complains about missing definitions for the two
> functions I use: init & close.
> All the complaints seem like simple functions or types that are defined in
> the system. ie. floor is defined in math.h
> I assume there are references to these functions or types in the archive
> that cannot be resolved (lack of header file).
> If this is the case, where do I include the appropriate header files? It
> seems I shouldn't have to do this in my source.
>
> I'm compiling on a Solaris 7 machine w/ dual Compaq Alphas.
>
> I'll be glad when someone points out my ignorance.
>
> Puzzled,
> -Nick G.
Hi,
you need to add -lsocket -lnsl -lm to your libs thats where these functions
are...
lars
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php