APUE source code usage

Source: Internet
Author: User

Apue source code usage
1. Download the source code and decompress it to http://www.apuebook.com/download the source code wget http://www.apuebook.com/src.tar.gz-P/usr/local/src
Decompress the source code to the specified path:/root/bin, which is specified by the-C parameter. decompress the package to generate the apue.2e directory in the specified directory.
Tar zxvf/usr/local/src/src.tar.gz-C/root/bin
2. Modify the working path and awk Tool Name
Vi/root/bin/apue.2e/Make. defines. linux
Change the WKDIR to the path strength we have extracted.
WKDIR =/root/bin/apue.2e
Vi/root/bin/apue.2e/std/linux. mk
Replace nawk with gawk.
Gawk-f makeconf. awk> conf. c
Gawk-f makeopt. awk> options. c
3. compile and generate the static library libapue.
Cd/root/bin/apue.2e/lib
Make-f linux. mk
If an "ARG_MAX" undefined error is reported during make, modify the apue. h file under the include directory and add a line: # define ARG_MAX 4096
Modify the threadctl/getenv1.c and threadctl/getenv3.c files, add # include "apue. h", and then make
4. Copy the corresponding file to the corresponding directory:
Static library file: libapue.
Header file: apue. h
Cp/root/bin/apue.2e/lib/libapue. a/usr/include/
Cp/root/bin/apue.2e/include/apue. h/usr/apue/include/
5. In this way, you can use # include <apue. h> in your own code. You need to add the-lapue option during compilation. For example, you need to compile hello. c:
Gcc hello. c-lapue-o hello

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.