文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>APUE书中代码的编译

APUE书中代码的编译

时间:2007-05-17  来源:zw2002

最近在看APUE第二版,发现下载的书的代码编译不了,所以把方法总结一下。
1、我的是用虚拟机,系统Red Hat Enterprise Linux AS release 3
2、下载本书的代码:
ftp://ftp.uu.net/published/books/stevens.advprog.tar.Z
mkidr test
cd test
tar -zxvf stevens.advprog.tar.Z
进去后发现系统缺少
Make.def.rhlin
lib.rhlin
3、要去这个地址下载原来的库,然后把上面的文件和目录copy过来
http://www.kohala.com/start/apue.html
找到Here is an another version of the Linux source code, supplied by a reader, that supposedly works under RedHat 6.0.
4、先makelibmisc.a文件
也要解压缩,然后把上面的文件和目录cp到你的test/apue目录
要改一下文件的权限
lib.rhlin]# chmod 755 systype.sh
然后就可以make出libmisc.a
要改一下Make.defines中libmisc.a库的路径要为你的
我的路径是
LDLIBS=/root/test/apue/libmisc.a
LIB = /root/test/apue/libmisc.a
5、然后再make你需要的文件
#cd file
#make
gcc -ggdb -Wall -Wstrict-prototypes -O             access.c  /root/test-shiyan/apue/libmisc.a              -o access
/root/test-shiyan/apue/libmisc.a(strerror.o)(.text+0x18): In function `strerror':
/root/test-shiyan/apue/lib.rhlin/strerror.c:12: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/root/test-shiyan/apue/libmisc.a(strerror.o)(.text+0xf):/root/test-shiyan/apue/lib.rhlin/strerror.c:11: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
gcc -ggdb -Wall -Wstrict-prototypes -O             cdpwd.c  /root/test-shiyan/apue/libmisc.a               -o cdpwd
6、去掉警告信息
make时还会出现上面的错误,按照提示做就可以了
把lib.rhlin Makefile中的strerror.o删除就不会有警告了
会提示没有目标devfd,还有其它的一些,在Makefile中把这些删除就可以了,只剩下面的。
PROGS = access cdpwd changemod conf devrdev \
        fileflags  filetype ftw4  \
        hello hole  longpath ls1 mycd \
           testerror  \
        uidgid umask unlink
相关阅读 更多 +
排行榜 更多 +
拉力竞速2

拉力竞速2

体育竞技 下载
文字乱舞水浒

文字乱舞水浒

角色扮演 下载
蓝图公考

蓝图公考

学习教育 下载