UNIX网络编程 环境搭建

配置好动态连接库或者静态连接库
html

1,下载UNIX网络编程书的头文件及示例源码unpv13epython

2    按照readme来编译编程

Execute the following from the src/ directory:网络


    ./configure    # try to figure out all implementation differencesapp


    cd lib         # build the basic library that all programs needtcp

    make           # use "gmake" everywhere on BSD/OS systemsoop


    cd ../libfree  # continue building the basic libraryui

    makespa

3. 这个时候能够按照readme里提到的方法编译运行该源文件里的代码.net

cd ../intro    # build and test a basic client program

    make daytimetcpcli

    ./daytimetcpcli 127.0.0.1

可是若是想在任何位置均可以编译unix网络编程的程序, 或者说使用unp.h头文件

4,将生成的libunp.a静态库复制到/usr/lib/和/usr/lib64/中。

[html]  view plain  copy
 print ?
  1. cd ..   //回到unpv12e目录  
[html]  view plain  copy
 print ?
  1. sudo cp libunp.a /usr/lib  
  2. sudo cp libunp.a /usr/lib64  


5,修改unp.h并将其和config.h拷贝到/usr/include中,为了之后include方便

[python]  view plain  copy
 print ?
  1. gedit lib/unp.h   //将unp.h中#include "../config.h"修改成#include "config.h"  
[python]  view plain  copy
 print ?
  1. sudo cp lib/unp.h /usr/include  
  2. sudo cp config.h /usr/include  




相关文章
相关标签/搜索