UNIX网络编程配置unp.h头文件

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


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_

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值