《UNP》中源代码的编译和使用

《UNP》中源代码的编译和使用

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

If all that works, you


其实需要执行的就是前三步,其实就是为了生成libunp.a。复制这个静态库到/usr/lib/和/usr/lib64/中,因为后来编译程序的话需要用到这个静态库。还得在环境变量中将这两个路径加上。

接下来的是头文件unp.h的问题,这个文件在这个解压缩目录的lib文件夹中。

因为里面所有的文件都包含了#include“unp.h”这一句话,为了方便可以有两种方法:
一:
1.将lib下面的unp.h复制到/usr/include文件夹下面,并保证环境变量中有/usr/include;
2. 因为unp.h中有#include "../config.h",所以得把解压缩目录下面的config.h复制到/usr/include中,并将unp.h中的#include "../config.h"改成 #include "config.h"。
3在unp.h中添加一行:
#define MAX_LINE 2048

二:
1.将lib文件夹下面的unp.h移到unpv13e中,
2.参照上面的第二条;
3.参照上面的第三条;
4.以后在子文件夹里面编译程序,把#include"unp.h"改为#include"../unp.h"

做完上面,我们就可以编译单个程序了,比如intro/byteorder.c。

 gcc -W -o byteorder byteorder.c -lunp
 ./byteorder
i686-pc-linux-gnu: little-endian

转载于:https://www.cnblogs.com/liulipeng/archive/2013/03/23/2977227.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值