Installation of apue.3e (based on ubuntu12.0.4)

Source: Internet
Author: User

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)

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.