This dish just learned UNIX under the advanced programming, helpless to build this book programming environment encountered many problems. Fortunately, there are all kinds of great God solutions on the Internet that I finally solved the problem. Thank you for the great God who fought for the Linux open source operating system.
However, the Internet is mostly for UNIX advanced programming second edition of the header files, and now for the third version, some outdated, because the make file for Linux has changed a lot.
Not much to say, the following to see the concrete construction process: (I use the operating system is Ubuntu 14.04LTS)
1. Download the source code of the book online and click on the link to open it
2. Unzip the file: TAR-ZXVF *.tar.gz
3.CD apue.3e/
4.make
In this process, you will see the final result due to can,t Find-lbsd and cannot succeed, the solution is to add libbsd.a static link Library
sudo apt-get install Libbsd-dev
5.make (again)
6. On the basis of successful compilation, we install the apue.h file and its corresponding static link library Libapue.a
sudo cp./include/apue.h/usr/include/
sudo cp./lib/libapue.a/usr/local/lib/
Why would you want to move Libapue.a to/usr/local/lib? The reason is that LIBAPUE.A is the concrete implementation of all functions and macro definitions contained in the Apue.h header file, and is a static link library.
View ld.conf.d/libc.conf you will find that GCC will search the link library by default when searching for files in/usr/local/lib/, so we'll put it here, once and for all .... (But I need to know OH)
7. The above environment is built successfully, the following is the test.
8.GCC 1-3.c-o 1-3-lapue (libapue.a here to write apue, specific GCC use rules can man, hehe)
9. See 1-3 Execute the program now, execute it quickly.
./1-3.
Original address:
Http://blog.sina.com.cn/s/blog_94977c890102vdms.html
APUE.3E Installation (ubuntu12.0.4-based)