UNIX网络编程 卷2 源代码使用
2016-11-18 23:49
309 查看
1. 下载源码,W. RichardStevens的主页:http://www.kohala.com/start/
wget http://www.kohala.com/start/unpv22e/unpv22e.tar.gz -P/usr/local/src
2. 解压
tar xvf /usr/local/src/unpv22e.tar.gz -C/root/bin
3. 编译库文件
cd /root/bin/unpv22e/
./configure
编辑生成config.h文件,注释以下几行
vi config.h
56 // #define uint8_t unsigned char
57 // #define uint16_t unsigned short
58 // #define uint32_t unsigned int
添加MSG_R和MSG_W定义
vi config.h
66 // add by jcq
67 typedef unsigned long ulong_t;
68 #define MSG_R 0400
69 #define MSG_W 0200
添加_GNU_SOURCE定义
vi config.h
#define _GNU_SOURCE
编译warpunix.c,使用mkstemp函数替换mktemp函数
cd lib
181 void
182 Mktemp(char *template)
183 {
184 if (mkstemp(template) == NULL || template[0] == 0)
185 err_quit("mktemp error");
186 }
编译生成libunpipc.a
cd lib
make
4. 构建自己的编写代码的目录
mkdir -p /root/bin/unpv2
cd -
cp /root/bin/unpv22e/libunpipc.a /root/bin/unpv22e/config.h/root/bin/unpv22e/Make.defines .
5. 编译各个目录自己的文件
复制各个子目录下得*.h头文件和Makfile文件,然后执行
cp /root/bin/unpv22e/dir/*.h /root/bin/unpv22e/dir/Makefile/root/bin/unpv2
make filename
即可编译各个子目录下的代码
wget http://www.kohala.com/start/unpv22e/unpv22e.tar.gz -P/usr/local/src
2. 解压
tar xvf /usr/local/src/unpv22e.tar.gz -C/root/bin
3. 编译库文件
cd /root/bin/unpv22e/
./configure
编辑生成config.h文件,注释以下几行
vi config.h
56 // #define uint8_t unsigned char
57 // #define uint16_t unsigned short
58 // #define uint32_t unsigned int
添加MSG_R和MSG_W定义
vi config.h
66 // add by jcq
67 typedef unsigned long ulong_t;
68 #define MSG_R 0400
69 #define MSG_W 0200
添加_GNU_SOURCE定义
vi config.h
#define _GNU_SOURCE
编译warpunix.c,使用mkstemp函数替换mktemp函数
cd lib
181 void
182 Mktemp(char *template)
183 {
184 if (mkstemp(template) == NULL || template[0] == 0)
185 err_quit("mktemp error");
186 }
编译生成libunpipc.a
cd lib
make
4. 构建自己的编写代码的目录
mkdir -p /root/bin/unpv2
cd -
cp /root/bin/unpv22e/libunpipc.a /root/bin/unpv22e/config.h/root/bin/unpv22e/Make.defines .
5. 编译各个目录自己的文件
复制各个子目录下得*.h头文件和Makfile文件,然后执行
cp /root/bin/unpv22e/dir/*.h /root/bin/unpv22e/dir/Makefile/root/bin/unpv2
make filename
即可编译各个子目录下的代码
相关文章推荐
- UNIX网络编程 卷2 源代码使用
- 2012-02-20 10:46 UNIX网络编程 源代码 使用方法
- UNIX网络编程 卷2 源代码使用
- UNIX网络编程 卷2 源代码使用
- UNIX网络编程 卷2 源代码使用
- UNIX网络编程之源代码的编译和使用
- (转)UNIX网络编程 卷2 源代码使用
- UNIX网络编程 卷2 源代码使用
- 《unix网络编程》(1)源代码的使用方法
- UNIX网络编程 卷2 源代码使用
- Unix网络编程 卷2:进程间通信(linux环境下源代码使用)
- 一个使用监听器模式实现的J2ME网络编程框架,包括一个简单的登录功能实现(含源代码)
- 在锐捷802.1x网络中使用xsupplicant的补丁进行认证的源代码和教程
- 使用.net进行Base64数据加密算法(源代码)
- C/S服务器测试工具(包括源代码)。专业程序员使用
- 使用Antlr和JfreeChart实现项目源代码行数计算图表
- 使用动态包导出函数的调用单元完整源代码
- 使用源代码分析工具分析ASP源代码的方法
- 使用visual source safe进行源代码管理 (转)
- 使用Ant编译Eclipse源代码(续)