【Unix网络编程】配置unp.h

1、下载源文件: http://www.unpbook.com/unpv13e.tar.gz

2、解压文件:

tar -xzvf unpv13e.tar.gz

3、进入unpv13e文件夹,运行configure

cd unpv13e
./configure

4、进入lib文件夹,运行make

cd lib
make

5、以上生成了libunp.a 的静态库,将生成的静态库复制到操作系统的库目录中(/usr/lib)

cd ..
sudo cp libunp.a /usr/lib/

6、将config.h(在目录unpv13e下)放入目录/usr/下,将unp.h(在目录unpv13e/lib/下)放入目录/usr/lib/和目录/usr/include/下。

sudo cp config.h /usr/
cd lib
sudo cp unp.h /usr/lib/
sudo cp unp.h /usr/include/

7、使用时只需要 #include <unp.h>就可以了。

8、测试程序:test.c

#include <unp.h>
#include <stdio.h>
int main(){
	printf("test\n");
	return 0;
}
gcc test.c -o test -lunp
./test

参考:https://www.cnblogs.com/tyrus/p/unix_unpv13e.html

发布了92 篇原创文章 · 获赞 2 · 访问量 3432

猜你喜欢

转载自blog.csdn.net/zxc120389574/article/details/104722512
今日推荐