Source code process for compiling Apue (Advanced UNIX Environment programming) in Mac OS X 10.8 _c language

Source: Internet
Author: User

Recently in the revision of APUE ("UNIX Environment Advanced Programming"), previously in Linux, and now intend to get down in their own machine, so Google, the compilation of things done, modify some of the tutorials some errors, such as download links and so on.

1, download source files, I am here is the second edition, looks like the third edition of the English version out ...

Copy Code code as follows:

wget http://www.apuebook.com/src.2e.tar.gz

2, decompression

Copy Code code as follows:

Tar zxf src.2e.tar.gz

3, modify some things

Copy Code code as follows:

CD apue.2e/
Vim Make.defines.macos
WKDIR=/USERS/CHENQING/APUE.2E//Change the absolute path to your code
Vim include/apue.h
After line 11th, add the following three sentences
#ifdef MACOS
#define _darwin_c_source
#endif

4, compile

Copy Code code as follows:

Make all

5, copy

Copy Code code as follows:

sudo cp include/apue.h/usr/include/
sudo cp lib/error.c/usr/include/

6. Modify Apue.h

Add a row before the last line #endif #include "error.c"

7. Test

Copy Code code as follows:

#include <apue.h>
int main ()
{
Err_sys ("Some error found%d", getpid ());

return 0;

}

Related Article

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.