Compile error with SUN Compilers

From: cloper (cloper@crowncollege.edu)
Date: Wed Sep 24 2003 - 18:41:47 EDT


SunManagers,

I am getting errors when I attempt to compile my source code that I am
working on. This software binds to a port, and allows multiple
connections using select() calls. I had the problem earlier where it
could not find the socket libraries, so i compiled with: `cc new.c
-lsocket -lnls -o new` and it worked fine. Well, the problem is I added
a printf() statement that calls inet_ntoa(). Here is the code snipplet.

...
printf("+ client connection from %s (fd #%d)\n",
inet_ntoa(raddr.sin_addr), cli);
...

This is the error I receive.

-bash-2.05b$ cc new.c -lsocket -lnls -o new
Undefined first referenced
 symbol in file
inet_ntoa new.o (symbol belongs to implicit
dependency /usr/lib/libnsl.so.1)
ld: fatal: Symbol referencing errors. No output written to new
-bash-2.05b$

I asked in #c and #solaris on freenode, but no one had a clue.

Here is my $PATH and $LD_LIBRARY_PATH

-bash-2.05b$ echo $PATH
/usr/j2se/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/sfw/bin:/usr/local/bin:/opt/SUNWspro/bin/:/usr/ccs/bin:/usr/ucb:/usr/openwin/bin
-bash-2.05b$ echo $LD_LIBRARY_PATH
/usr/lib:/opt/SUNWspro/lib:/usr/ucb:/usr/ccs/lib:/usr/openwin/lib:/usr/local/lib:/usr/local/ssl/lib
-bash-2.05b$

The code was successfully compiled and run on Linux and BSD platforms.

Thanks a bunch,
cloper@crowncollege.edu
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:27:11 EDT