文章目录
unp是unix 网络编程的缩写。
环境:centos7.4
下载地址:http://www.unpbook.com/unpv13e.tar.gz
1.下载命令
wget http://www.unpbook.com/unpv13e.tar.gz
2.解压unpv13e
ls -hl | grep unpv13e.tar.gz # 查看压缩包
sudo tar -zxvf /root/unpv13e.tar.gz # 解压路径填写为绝对路径,我这边用相对路径会提示*.c文件不是目录啥的
3.查看README
按照自述里的内容来配置:
Execute the following from the src/ directory:
./configure # try to figure out all implementation differences
cd lib # build the basic library that all programs need
make # use "gmake" everywhere on BSD/OS systems
cd ../libfree # continue building the basic library
make
cd ../libroute # only if your system supports 4.4BSD style routing sockets
make # only if your system supports 4.4BSD style routing sockets
cd ../libxti # only if your system supports XTI
make # only if your system supports XTI
cd ../intro # build and test a basic client program
make daytimetcpcli
./daytimetcpcli 127.0.0.1
3.1配置脚本
在unpv13e目录下执行.configure:
./configure
3.2创建lib库
cd lib
make
3.3创建libfree
cd ../libfree
make
make出错:
inet_ntop.c:60:9: error: argument ‘size’ doesn’t match prototype
size_t size;
解决方法:
inet_ntop.c的第60行:size_

本文详细介绍了在CentOS 7.4环境下如何从下载、解压到配置和测试,完成UNIX网络编程(UNP)环境的搭建过程。针对在编译过程中遇到的错误,如inet_ntop.c和unproute.h的问题,提供了具体的解决方案,并指导如何使unp.h头文件全局可用,最后通过编写程序验证了环境的正确性。
1万+

被折叠的 条评论
为什么被折叠?



