What should I do if Unix cannot find the apue.h file?

  

A lot of Linux beginners can't find the apue.h file mentioned in the article when they study the book "Advanced Programming in Unix Environment". So what should I do? The following small series will introduce you to the solution to the Unix can not find the apue.h file.

when the program is run in this book "unix-level programming environment", the compiler will not prompt apue.h this header file. Apue.h is a header file customized by the author, including the common header files and error handling functions required by the program, so it should be put into the system header file (/usr/include under Linux), so the gcc compiler I can find it.

The solution to this problem is as follows:

1. Download the two files apue.h and error.c corresponding to the book on the Internet;

2. Switch to the root user (the normal user does not have enough permissions to copy files to the /usr directory);

3. Modify the apue.h file. We need to add #endif /* _APUE_H */in the apue.h file. Save the file after #include “error.c”

4. Copy these two files to the /usr/include directory;

For example: cp /home/liupenghui/desktop/apue.h /usr/include/apue.h< Br>

cp /home/liupenghui/Desktop/error.c /usr/include/error.c

5.OK! Now you can run the program in the book.

The above is the introduction of Unix can not find the solution to the apue.h file, in fact, the apue.h file is a header file written by the author himself, can not be found in the system, can be downloaded from the network .

Copyright © Windows knowledge All Rights Reserved