apue.h header file installation tutorial (local && system) Unix environment advanced programming (third edition)

 Note, operate under the root user (or use sudo)

1. Download

1. cd to the directory where you want to save the file (myincude), enter:

Download it yourself: https://download.csdn.net/download/qq_43445867/88084793

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

 2. Unzip:

tar -zxvf src.3e.tar.gz

2. Installation

cd to the apue.3e directory, execute sudo make

cd apue.3e/
sudo make

(If an error can't find ... is reported during compilation, you need to install sudo  apt-get install libbsd-dev and make again)

 

 implement

sudo apt-get install libbsd-dev

 3. Use

1. Local calls

1.1 copy error.c

In the apue.3 folder, copy error.c under the lib folder to the include folder

1.2 Add error header file to include/apue.h

1.3 header file reference

quote

#include "/home/wen/myincude/apue.3e/include/apue.h"

1.4 compile

gcc signal.c -L /home/wen/myincude/apue.3e/lib/apue

2. System call

2.1 Copy error.c

In apue.3, copy error.c under the lib folder to /usr/include/

sudo cp lib/error.c /usr/include/

2.3 Copy apue.h under include to /usr/include/

sudo cp include/apue.h /usr/include/

2.2 Add error header file to include/apue.h

2.3 Copy static library files

sudo cp lib/libapue.a /usr/local/lib/

2.3 header file reference

#include "apue.h"

2.3 compile

gcc signal.c -l apue

Guess you like

Origin blog.csdn.net/qq_43445867/article/details/131887385