Method 1:
1. apue2 source code download: http://www.apuebook.com/src.tar.gz
2. I saved it to/root. decompress: tar-xzvf src.tar.gz
3. Run CD apue.2e To Go To The apue.2e directory and check readme. This tells us that you only need to modify make. Defines. Linux and then make
4. In VI make. Defines. Linux, modify wkdir =/root/apue.2e to indicate that the working directory is wkdir =/root/apue.2e.
5. Modify/root/apue.2e/STD/Linux. mk to change all nawk to awk. Because some Linux do not have nawk by default
6. Make
Now, you can copy it to what you can look for. When writing an example, you can
4. Copy apue2e_src/apue.2e/include/apue. h and apue2e_src/apue.2e/lib/libapue..
Go to your source code directory.
5. Use gcc-O hello. c libapue. A to compile your source code.
Method 2:
Examples of apue programming are related to include "apue. H "code, in fact, apue. H is not included in the system. It is the header file compiled by the author. The source code is in appendix B. therefore, one method is. put the generated/root/apue.2e/include/apue. copy h directly to/usr/include.
Functions like err_sys are also included in appendix B. the same method is to create a my_err.h file in/usr/include and copy the content of Figure B .3. error functions that output to standard error. in this way, you only need to add # include "my_err.h" at the beginning of the line for example programming ..
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/csufuyi/archive/2008/03/25/2218074.aspx