声明:本文章转载自:http://blog.sina.com.cn/s/blog_967e337b01011nix.html
Linux环境:
Linux localhost.localdomain 2.6.18-238.el5 #1 SMP Sun Dec 19 14:24:47 EST 2010 i686 i686 i386 GNU/Linux
确保你已经安装了gcc和gawk。
步骤
1.到www.apuebook.com下载源码
2.tar解包,cd apue.2e
3.vi Make.defines.linux
4.vi include/apue.h
5.vi threadctl/getenv1.c
6.vi threadctl/getenv3.c
7.vi threads/badexit2.c
8.vi std/linux.mk
9.将apue.2e/ipp/ipp.h的宏定义:#define status u.sth中的status改成Status;然后将同目录下的printd.c中的977行的i=ntohs(hp->status);中的status改成Status。
10.make
11.sudo cp include/apue.h /usr/include
好了,测试一下,记得要用-lapue命令让编译器链接apue库
gcc main.c -lapue