I am trying to compile code related to the book "Advanced Programming in the UNIX® Environment"
When I try to compile a test file like so:
$ gcc -L ../lib/ -l apue foo.c
I get:
/tmp/cccXkUae.o: In function `main':
foo.c:(.text+0x2b): undefined reference to `err_sys'
...
collect2: error: ld returned 1 exit status
However, it seems the function is defined in the lib...
$ grep err_sys ../lib/libapue.a
Binary file ../lib/libapue.a matches
Ultimately, this does compile with no errors:
$ gcc foo.c ../lib/error.c
Just trying to understand what I am doing wrong.