Senior UNIX Programming Environment apue.h error

Richard Stevens recently reading the masterpiece "UNIX Advanced Programming Environment", I believe many people will first reading this book and I encountered this problem, as compiled in the book examples of problems when, "Error: apue.h: no such file or directory. "

apue.h is the author of a custom header file, not a Unix / Linux system comes, this header file include the required header files and Unix utilities commonly used by Richard to write their own error handling function. So by default, gcc compile time is not read in this header file.

In this first website  http://www.apuebook.com/  download tar.gz source package format, and then extract it to a directory, such as / home / yarkee / down, and then go to the directory apue.2e, the file Make. defines.linux in wKDIR = / home / xxx / apue.2e modify wKDIR = / home / yarkee / apue.2e , and then into the directory under apue.2e std directory, open linux.mk, all the inside nawk replace awk, if it is used in vi / vim editor can use this command: 1. $ s / nawk / awk / g ( note preceded by a colon)
then type make in this directory, i.e., back / home / yarkee / apue.2e directory input "./make" (without the quotes) in the terminal

Then apue.h /home/yarkee/apue.2e/inlcude files in directories and files are located /home/yarkee/apue.2e/lib error.c directory are copied to the / usr / include directory, pay attention to copy these two documents you need to have root privileges. The reason for this is because gcc at link header files to / usr / include this directory to find the required header files, if you can not find the error.

Edit it will eventually be copied apue.h file
to add a line #include "error.c" in front of the last line #endif

This will not be the error.

Reproduced in: https: //www.cnblogs.com/kungfupanda/archive/2012/09/14/2685410.html

Guess you like

Origin blog.csdn.net/weixin_34050427/article/details/94493216