Overall CompilationCode
1. Decompress src.rar and release the file to the root directory of the current user (/users/lishujun /)
2. Access/users/lishujun/apue.2e.
3. Modify the make. Define. MACOs file and specify the directory where the source code is located.
Wkdir =/users/lishujun/apue.2e
4. Go to the/users/lishujun/apue.2e/include directory and modify apue. h.
# IfDefined (Solaris)# Define_ Xopen_source 500/* single UNIX specification, version 2 for Solaris 9 */# DefineCmsg_len (x) _ cmsg_data_align (sizeof (struct cmsghdr) + (x ))# ElifDefined (MACOs)/* adds this line. Note that there is no exclamation point */# Elif! Defined (BSD)# Define_ Xopen_source 600/* single UNIX specification, version 3 */# Endif
5. Return to the upper-level directory and execute the compilation command.
MakeCleanMakeMacOS
6. Verify that the compilation is successful. Go to the/users/lishujun/apue.2e/file directory, modify ls1.c, and change the header file to ../include/apue. H. Then
GccLs1.c ../lib/libapue.
The A. out file is ls.