The first apue. h error in UNIX Advanced Programming

Source: Internet
Author: User

Transferred from csdn Forum

Beginner "UNIX environment advanced programming" friends will encounter a problem, run inside the instance (download: http://www.apuebook.com/) problems, prompt "error: apue. h: No file or directory ".

Apue. h is a header file customized by the author, including common header files and error handling functions required by the program. So it should be put into the system header file (/usr/include in Linux), so that the gcc compiler can find it.
Go to the tar.gz package of the website downlowd apue and decompress it to a directory on the computer. For example, if my package is under/home/user/, go to the decompressed directory apue.2e and modify Make. defines. in linux, WKDIR =/home/xxx/apue.2e is WKDIR =/home/user/apue.2e. This is the working directory we will make and then enter the std directory, use vi to open linux. mk to change all the nawk in it to awk. You can use this command
: % S/nawk/awk/g (note that there is a colon Before)
Then make
Perform the following steps:
1. logon with Super User Permissions # cd/usr/include
2. copy the apue. h and error. c files to this directory. (Apue. h is located in your_apue_path/inlcude; error. c is located in your_apue_path/lib)
Take my path as an example:
# Cp/home/ucfree/apue.2e/inlcude/apue. h.
# Cp/home/ucfree/apue.2e/lib/error. c. (implement the error handling function in apue. h)
3. Edit apue. h.
# Vi apue. h
Add a line before the last line # endif # include "error. c"
: Wq save, exit.

In this way, you can run the downloaded apue program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.