Learning C programming problem

Simon Clayton Simon at RefTech.co.uk
Thu Jan 25 15:19:12 GMT 2001


Thanks for that - the next problem is then that if I try and remove the
libraries (which I did anyway) when I try and connect to MySQL with

	mysql_real_connect(&mysql, "localhost", "user", "password", "db", 0, "",
0);

The program compiles fine but then when I do

	./test

I get

	Can't connect to local MySQL server through socket '' (2)

Any ideas?

Simon

-----Original Message-----
From: freebsd-users-admin at uk.freebsd.org
[mailto:freebsd-users-admin at uk.freebsd.org]On Behalf Of Paul Civati
Sent: 25 January 2001 15:16
To: freebsd-users at uk.freebsd.org
Subject: Re: Learning C programming problem


Simon,

> 	gcc -g -o test
>
test.c -L/usr/local/lib/mysql -I/usr/local/include/mysql -lmysqlclient -lsoc
> ket -lnsl
>
> We get
> 	/usr/libexec/elf/ld: cannot open -lsocket: No such file or directory

The 'socket' and 'nsl' libs are typically needed when compiling under
Solaris, thus you shouldn't need them.

> Being completely new to this stuff we read some man pages and found that
the
> file should be called libsocket.a but can't locate it anywhere on our

The socket and name server libraries are part of the libc on
{Free,Net,Open}BSD so you should be able to remove the '-l' libary
references.

> server.  Being as the server was never built with C programming in mind it
> is perfectly likely that this file (and libnsl.a) are missing.
>
> So, the question is - where can I install these files from?

No need.

-Paul-

------ FreeBSD UK Users' Group  -  Mailing List ------
http://listserver.uk.freebsd.org/mailman/listinfo/freebsd-users






More information about the Ukfreebsd mailing list