To compile the APUE V2 (Ubuntu 13.10 X64)


1 change the variable WKDIR, point to your APUE source location

vi Make.defines.linux

2 add a constant ARG_MAX, #define ARG_MAX 4096

vi include/apue.h 
3 increase#include "apue.h"

vi threadctl/getenv1.c
vi threadctl/getenv3.c

The 4 amendment thirty-first, the pthread_self () returns the value into a int type. printf("thread 2: ID is %d\n", (int)pthread_self());

vi threads/badexit2.c 
5 will be two nawk to awk

vi std/

The 6.ipp.h file of status changed to another name, such as Status; printd.c 977th line: I = ntohs (hp-> status) status change for Status

vim ipp/ipp.h vim ipp/printd.c
7 compiler

8 subsequent processing

sudo cp include/apue.h /usr/include
sudo cp lib/libapue.a /usr/lib

9 test ls.c

#include <dirent.h>
#include "apue.h"

main (int argc , char *argv[])
    DIR *dp;
    struct dirent *dirp;
    if(argc != 2)
        err_quit("usage : ls directory_name");
    if( (dp = opendir(argv[1])) == NULL)
            err_sys("can't open %s", argv[1]);
    while((dirp = readdir(dp)) != NULL)
gcc ls.c -lapue

Reference resources

  1. Advanced UNIX programming (Second Edition) / APUE compiler source code and use
  2. The APUE file in the make when prompted timex.h, make failed

Posted by Chelsea at February 19, 2014 - 7:32 PM