您的位置:首页 > 产品设计 > UI/UE

unix环境高级编程apue.h文件头的安装

2018-01-14 15:59 357 查看
工作了,以前只停留在pad里的书都想入手。手里有了unix网络编程卷1卷2,最近看ceph源码的过程中,越来越发现需要补充unix环境高级编程的知识。

从pad中走向了实体书。中午快递到货,迫不及待的翻开了。第一件事,安装

#include"apue.h"


1.官网下载

下载传送门

2.解压make

安装点依赖gcc make啥的

一make,果然报错,人生啊总是要走很多“弯”路。

/tmp/ccMkguDl.o: In function `thr_fn':
barrier.c:(.text+0x80): undefined reference to `heapsort'
collect2: error: ld returned 1 exit status
make[1]: *** [barrier] Error 1
make[1]: Leaving directory `/root/apue.3e/threads'
make: *** [all] Error 1
[root@localhost apue.3e]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* epel: mirror.lzu.edu.cn
* extras: mirrors.shu.edu.cn
* updates: mirrors.cn99.com
No packages marked for update


在这里缺少一个libbsd

下载

wget http://elrepo.reloumirrors.net/testing/el6/x86_64/RPMS/libbsd-devel-0.2.0-4.el6.elrepo.x86_64.rpm wget http://elrepo.reloumirrors.net/testing/el6/x86_64/RPMS/libbsd-0.2.0-4.el6.elrepo.x86_64.rpm


安装

rpm -ivh libbsd-0.2.0-4.el6.elrepo.x86_64.rpm
rpm -ivh libbsd-devel-0.2.0-4.el6.elrepo.x86_64.rpm


3.重新make

成功

4.加入include

将apue.h中加入#include”error.c”

void    log_exit(int, const char *, ...) __attribute__((noreturn));
void    TELL_WAIT(void);        /* parent/child from {Sec race_conditions} */
void    TELL_PARENT(pid_t);
void    TELL_CHILD(pid_t);
void    WAIT_PARENT(void);
void    WAIT_CHILD(void);
#include"error.c"
#endif  /* _APUE_H */


cp include/apue.h lib/error.c /usr/include/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: