UNPv13e中源代码编译(即如何使用头文件unp.h问题)

1.下载代码:官方下载http://www.unpbook.com/src.html

2.安装依赖库

sudo apt-get install libbsd-dev

3.解压并进入解压后的文件夹(我的是解压到/root/unpv13e)

tar -zxvf unpv13e.tar.gz -C /root/unpv13e

4.按照README中的指导步骤进行(其中很详细)

            QUICK AND DIRTY
===============


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


If all that works, you're all set to start compiling individual programs.


Notice that all the source code assumes tabs every 4 columns, not 8.


5.复制头文件(unp.h)和动态链接库(libunp.a)

sudo cp ./lib/unp.h  /usr/include/  
sudo cp ./libunp.a  /usr/local/lib/  
sudo cp ./libunp.a  /usr/lib/ 
6.注销重启

7.运行程序时后面加上链接库即可(即 -lunp)

  eg. gcc -o daytimetcpcli daytimetcpcli.c -lunp



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值