UNIX Advanced Environment Programming: source Code (APUE) download compile and run __ programming

Source: Internet
Author: User

As a whole, it's almost like UNPV, see my other blog post unpv13e
1. Source Download

Easiest way to do it: (wget tools are really easy to use)

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

2. Unpack View directory structure

sunxiaowu@sunxiaowu:~/downloads/apue/apue.3e$ dir
advio       figlinks  lib                   printer   standards
Daemons     filedir   Make.defines.freebsd  proc   stdio    datafiles Make.defines.linux    Pty       systype.sh
db          include   Make.defines.macos    README    Termios
Disclaimer  Intro     Make.defines.solaris
relation     Threadctl IPC1      Makefile              signals   threads
exercises      ipc2 Make.libapue.inc sockets
Vim README

Read the file called Disclaimer.

On Freebsd, type "Gmake".
On the other platforms, type ' make ' (as long as is the GNU make).

For FAQs, updated source code, and the lost chapter, and the http://www.apuebook.com.
Please direct questions, suggestions, and bugs reports to sar@apuebook.com.

Steve Rago
January 2013

3. Compile
Make

Timeout.c:119:5: Warning: ' condition ' May is used uninitialized in this function [-wmaybe-uninitialized]
  if (conditio N) {
     ^
timeout.c:125:34:warning: ' arg ' May is used uninitialized in this function [-wmaybe-uninitialized]
   ti Meout (&when, Retry, (void *) ((unsigned long) arg);
                                  ^
make[1]: Leaving directory '/home/sunxiaowu/downloads/apue/apue.3e/threadctl '
making threads
make[1] : Entering directory '/home/sunxiaowu/downloads/apue/apue.3e/threads '
gcc-ansi-i. /include-wall-dlinux-d_gnu_source  badexit2.c-o badexit2  -L. /lib-lapue-pthread-lrt-lbsd
/usr/bin/ld:cannot Find-lbsd
collect2:error:ld returned 1 exit status
m AKE[1]: * * * [badexit2] Error 1
make[1]: Leaving directory '/home/sunxiaowu/downloads/apue/apue.3e/threads '
Make: * * * [ALL] Error 1

Most of the compilation passed, but the last occurrence of the above error, you can see that the Threads module badexit2.c file compilation failed. The reason is operating system limitations, my use of ubunu14.04, in order to compile this file, need to be in the BSD (and some modules are not passed, most of these are the reason, interested readers can be in other operating systems to try)

4. Run

sunxiaowu@sunxiaowu:~/downloads/apue/apue.3e$ CD intro/
sunxiaowu@sunxiaowu:~/downloads/apue/apue.3e/intro$ Dir
getcputc    hello.c  Makefile  shell1    shell2.c      uidgid getcputc.c LS1 Mycat     shell1.c  testerror    uidgid.c
Hello       ls1.c    mycat.c    shell2 testerror.c
sunxiaowu@sunxiaowu:~/downloads/apue/apue.3e/intro$./hello 
Hello World from process ID 9793
sunxiaowu@sunxiaowu:~/downloads/apue/apue.3e/intro$


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.