Build an advanced programming and learning environment in UNIX --- apue. h, unix --- apue. h

Source: Internet
Author: User

Build an advanced programming and learning environment in UNIX --- apue. h, unix --- apue. h

This course has just learned advanced programming in UNIX, but has encountered many problems when setting up the programming environment of this book. Fortunately, there are various solutions on the Internet that allow me to finally solve the problem. I would like to thank you for your great efforts for the LINUX open-source operating system.

However, the net is mostly built for the header file of the second version of UNIX advanced programming. For the third version, it is outdated because the make file for linux has changed a lot.

Let's not talk about it much. Let's take a look at the specific construction process: (the operating system I use is ubuntu 14.04LTS)

1. Download the source code from the book online and click the open link.

2. decompress the file: tar-zxvf * .tar.gz

3. cd apue.3e/

4. make

In this process, you will see that the final can, t find-lbsd and cannot make successfully. The solution is to add the static Link Library of libbsd..

sudo apt-get install libbsd-dev

5. make (again)

6. After successful compilation, We will install apue. h and its static Link Library libapue..

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

Why should I move libapue. a to/usr/local/lib? The reason is that libapue. a is the specific implementation of all functions and macro definitions contained in the header file of apue. h. It is a static Link Library.

View ld. conf. d/libc. conf, you will find that gcc searches for files in/usr/local/lib/by default when searching for the Linked Library, so we will put it here, once and for all .... (But you need to know)

7. The above environment is successfully set up. The following is a test.

8. gcc 1-3.c-o 1-3-lapue (libapue. a is written as apue here. For specific gcc rules, Run man)

9. You have seen the 1-3 Execution program. Run it now.

./1-3 /lib



10. Finally, this example 1-3 is the first program in the book-the ls program.


Apueh configuration in advanced programming in unix environment

Compilation is very troublesome,
Decompress the content in the attachment to/usr/include/or/usr/local/include
You can.



How to configure apueh in advanced programming for unix environment

Can I stick the program to another header file?
In fact, when I write the header file, I just need to write the header file myself. Several Functions in the header file will know what they are doing by looking at their names. You can implement them by yourself.

Related Article

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.