日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

unix网络编程 的环境配置

發布時間:2023/12/13 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 unix网络编程 的环境配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

<unix網絡編程> 的環境配置

?

首先在網上下載UNP的庫文件,然后就可以安裝學了。我的系統環境:

2.6.32-131.0.15.el6.i686 #1 SMP Sat Nov 12 17:30:50 CST 2011 i686 i686 i386 GNU/Linux

LSB Version:?? ?:base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID:?? ?CentOS
Description:?? ?CentOS release 6.1 (Final)
Release:?? ?6.1
Codename:?? ?Final


一. 生成libunp.a靜態庫

??? cd unpv3e?? ??? ?#源目錄
?
??? ./configure ?? ?# try to figure out all implementation differences ?
? ??? ??? ??? ??? ??? ?生成config.h配置文件
?
??? 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 ?? ??? ??? ?生成libunp.a

二. 復制配置文件(也可用其他方法)
?? ?
?? ?cp unp.h ?? ??? ? /usr/local/include ?? ?//要該變root權限,unp.h在lib目錄中
?? ?cp unpthread.h? /usr/local/include? //線程的頭文件
?? ?cp config.h ?? ?/usr/local/include ?? ?//config.h在源目錄中
?? ?cp libunp.a ?? ?/usr/local/lib?? ??? ?//libunp.a在源目錄中
?? ?
三. 修改配置文件
?? ?
?? ?cd /usr/local/include
?? ?vim unp.h?? ?#include "../config.h" 改為 #include "config.h",unp.h和config.h是在一起的。

?? ?修改三個文件的權限屬主(chown,chgrp)等

?? ?為了使用g++進行編譯:
?? ?將unp.h和unpthead.h內容放在extern “C”中間
?? ?extern "C" {
?? ?...
?? ?} /* extern "C" */

?? ?為了可以調試打印在unp.h中添加:
?? ?#ifdef DEBUG
?? ?#define DPRINTF(fmt, ...)?? ??? ?printf(fmt, ##__VA_ARGS__), printf("\n"), fflush(NULL)?? ?
?? ?#else
?? ?#define DPRINTF(fmt, ...)?? ??? ?((void)0)
?? ?#endif

四. 修改環境變量(已添加的可以不用了)
?? ?
?? ?vim .bash_profile
?? ?PATH中添加/usr/local/include:/usr/local/lib

五. 驗證
?? ?
?? ?cd 源目錄/intro

?? ?gcc byteorder.c -o byteorder -lunp
?? ?./byteorder
?? ?i686-pc-linux-gnu: little-endian
?? ?驗證OK

注意: 我們自己寫程序時,不能使用c99標準的內容(例如for(int i)), 否則會出現unp.h編譯錯誤。
?? ?




?? ?

?

?

轉載于:https://www.cnblogs.com/hancm/p/3866731.html

總結

以上是生活随笔為你收集整理的unix网络编程 的环境配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。