Notes and code from APUE (Advanced Programming in the Unix Environment, 2nd Edition).
The book can be found here.
Source code can be found here.
/APUE/apue.2e
(compiled source code)
/APUE/chx
(my notes for chapter x)
I have compiled the source code on MAC. Suppose you just obtain the source code, then follow the [instrctions] (https://github.com/y-c/APUE/blob/master/apue.2e/README) to compile. If you are using MAC and it complains:
Undefined symbols for architecture x86\_64: "_CMSG_LEN", referenced from: _recv_fd in libapue.a(recvfd.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Simply adding -D\_DARWIN\_C\_SOURCE
into Make.defines.macos
will resolve the issue.
Suppose you have written your own file.c
in the folder APUE/ch1
, go to the folder and
gcc -o a file.c -L. ../apue.2e/lib/libapue.a