ld: fatal: Symbol referencing errors

ld: fatal: Symbol referencing errors

Post by Bernard Willemo » Fri, 12 Feb 1999 04:00:00



Hi,

I am pretty new to programming on UNIX and started to work on Solaris
2.4 with the GNU gcc compiler. I installed the binaries of GCC version
2.7.1 for solaris 2.4 - worked fine... Created some simple programs in c
and compiled them - still worked fine.

After this I wanted to write a simple program using gethostbyaddress,
but after compiling, the linker returns the following error: ld: fatal:
Symbol referencing errors.

# gcc /tmp/test.c
Undefined                       first referenced
 symbol                             in file
gethostbyaddr                       /tmp/cca0007X1.o
inet_addr                           /tmp/cca0007X1.o
inet_ntoa                           /tmp/cca0007X1.o

I supose the linker cannot find the libraries containing the right
symbols.

Can anyone tell me were to find the right libraries. Do I have to setup
LD_LIBRARY_PATH. If I have a library, is there a way to know what's
inside ? Were can I find information how to setup the gcc correctly,
include headers, libraries, etc...

Tried it out on Linux too, but there it is working fine. Of course on
the Linux, the gcc is already built-in if you check the option when
installing...

Bye, BW.

 
 
 

ld: fatal: Symbol referencing errors

Post by Eric Amic » Fri, 12 Feb 1999 04:00:00



> Hi,
> I am pretty new to programming on UNIX and started to work on Solaris
> 2.4 with the GNU gcc compiler. I installed the binaries of GCC version
> 2.7.1 for solaris 2.4 - worked fine... Created some simple programs in c
> and compiled them - still worked fine.
> After this I wanted to write a simple program using gethostbyaddress,
> but after compiling, the linker returns the following error: ld: fatal:
> Symbol referencing errors.

The man page for gethostbyaddress() should tell you which library you
need; just add the appropriate -l option.

--
Eric Amick
Columbia, MD