[comp.unix.questions] Lost C Subroutines

rg@psgdc (Dick Gill) (04/15/89)

I am having trouble installing the "slice" utility on my 
NCR Tower 32/600.  For some reason, the link to subroutines
regcmp and recex are not being established.  The following
is from the compile/link attempt and from a table of contents
listing of the archive file.
----------------------------------------------------------------
# make
	cc  -O  -DUSG -lPW -o slice  slice.o
undefined			first referenced
 symbol  			    in file
regcmp                              slice.o
regex                               slice.o
ld fatal: Symbol referencing errors. No output written to slice
*** Error code 13

Stop.
----------------------------------------------------------------
# ar -t /usr/lib/libPW.a

abspath.o
...
regcmp.o
regex.o
...
zeropad.o
----------------------------------------------------------------
Why are these subroutines not being found? Any insights will be appreciated.

Dick

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dick Gill              Professional Solutions Group          ..uunet!psgdc!rg
The quality of the circus here in Washington depends on the clowns you elect.

wescott@ncrcae.Columbia.NCR.COM (Mike Wescott) (04/17/89)

In article <189@psgdc> rg@psgdc (Dick Gill) writes:
> I am having trouble installing the "slice" utility on my 
> NCR Tower 32/600.
...
> 	cc  -O  -DUSG -lPW -o slice  slice.o
...
> Why are these subroutines not being found?

Wrong order specified on the command line in the makefile.  libPW.a (-lPW)
ought to be specified _after_ slice.o.  On the Tower (and many other Unix
machines) libraries and object files are processed in the order found.  When
libPW.a is searched there are very few undefined symbols, only main() and
exit() from crt0.o, but none from slice.o.

This should do the trick:

	cc -o slice slice.o -LPW

-- 
	-Mike Wescott
	 mike.wescott@ncrcae.Columbia.NCR.COM