[cs631apue] Question about the strmode

Jan Schaumann jschauma at stevens.edu
Fri Oct 7 11:22:00 EDT 2016


bzhang41 <bzhang41 at stevens.edu> wrote:
 
> I took your suggestions to use strmode(3), but I can't pass the cc -Wall 
> compile,
> it shows the following error:
> 
> /tmp/ccxcP9Dh.o: In function `lfdisplay':
> ls.c:(.text+0xea5): undefined reference to `strmode'
> collect2: ld returned 1 exit status

This is an error from the linker, not the compiler.  You need to link
with libbsd, as noted in the manual page:

LIBRARY
     Utility functions from BSD systems (libbsd, -lbsd)

So you would compile your files using:

cc -c -Wall file1.c
cc -c -Wall file2.c
cc -c -Wall file2.c
cc *.o -lbsd

-Jan


More information about the cs631apue mailing list