PDA

View Full Version : No library for socket programming



nignasi
November 29th, 2006, 08:18 PM
Hi,

I'm trying to compile some C programs with TCP/UDP sockets on a new Kubuntu 6.10. In fat I have the same problem mentioned in this forum

http://www.ubuntuforums.org/showthread.php?t=123645&highlight=-lsocket

This a fragment from makefile

------------------------------------
COMPILER = gcc
LIB = -lsocket -lnsl
OBJ = connectsock.o errexit.o

TCPdaytime: connectTCP.o $(OBJ) TCPdaytime.c
$(COMPILER) TCPdaytime.c connectTCP.o $(OBJ) -o TCPdaytime $(LIB)
------------------------------------

and this is 'make TCPdaytime' result.

---------------------------------
$ make TCPdaytime
gcc TCPdaytime.c connectTCP.o connectsock.o errexit.o -o TCPdaytime -lsocket -lnsl
/usr/bin/ld: cannot find -lsocket
collect2: ld returned 1 exit status
make: *** [TCPdaytime] Error 1
-----------------------------------

I already tried to load happycoders-libsocket and changed -lsocket with libsocket without success.

What can I do?

Thanks,

Ignasi

hod139
November 30th, 2006, 01:29 AM
Try installing


happycoders-libsocket-dev but leave it as -lsocket