Compiling Errors -- Symbol referencing

I'm trying to compile a FTP_API program. To do this you must use the libftp.so libary. But that libary has references which are not defined. Has anyone had this problems and how is it corrected??

The command line looks like this:--------------------------------------------
# cc ftpstock.c -lftp
Undefined.........................first referenced
symbol..............................in file
_xlisten............................./udk/usr/lib/libftp.so
_xbind.............................../udk/usr/lib/libftp.so
_xsetsockopt ..................../udk/usr/lib/libftp.so
_xconnect........................../udk/usr/lib/libftp.so
gethostbyname................./udk/usr/lib/libftp.so
_xaccept............................/udk/usr/lib/libftp.so
getservbyname................../udk/usr/lib/libftp.so
inet_ntoa.........................../udk/usr/lib/libftp.so
_xsocket............................./udk/usr/lib/libftp.so
inet_addr............................/udk/usr/lib/libftp.so
_xgetsockname................../udk/usr/lib/libftp.so
UX:ld: ERROR: a.out: fatal error: Symbol referencing errors. No output written to a.out
-------------------------------------------------------------------------------

Want do you guys think? I have stdio.h and net/libftp.h included in the file.

Thanks,
Mike

libftp.so needs the socket libaries. There was a thread recently with the same exact problem and the -lsocket or -lsock linker option was described. Sound like you need to link the socket libs.

I've done that and two different functions that have no references which are not defined pop up. It's an endless circle.

__use_iks_version.................../udk/usr/lib/libsocket.so
_set_use_iks_version............../udk/usr/lib/libsocket.so

Tkanks neo,

Mike

No, it is not an endless circle, it is a straight line making sure that all the libraries are linked during the linking phase -- pretty much one of the core architecturals constructs of C programming. Finding all the libraries takes time if you have not used them before. After using them; it gets easier :slight_smile:

Having said that, I am not sure which libs have the symbols you are missing in the sockets library. What version of UNIX are you working with and what is the compiler?

Did you try with
cc progra.c -lsocket -lnsl

not sure whether this will help you

thanks
Reddyb

Thanks guys,

reddyb--
including -lnsl worked!!!!

Thanks again,
Mike